Results 1 to 11 of 11

Thread: pulse on LPT1

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Is there a way to send a different pulse on each pin on the parallel port? I want to control a traffic light, and send a pulse on the first pin to control the red light, the second to control the yellow, and the third to control the green. How can I do this with visual basic?

    Thanks
    <removed by admin>

  2. #2
    New Member
    Join Date
    Jun 2000
    Posts
    10
    I've wanted to do similar things in the past. I've been told at least a couple of times that programming using the serial port is easier than using the parallel port. There's a very recent discussion around here actually about using the serial port. I think there's even an MS control included with VB that will allow you to talk to the serial port. Any chance you could use the serial port instead of the parallel?

  3. #3

  4. #4
    New Member
    Join Date
    Jun 2000
    Posts
    10
    I'm on a roll.

    There is a TON of stuff in the forums here on the MSCOMM control and serial communication. A search for just "serial" will turn up a lot.

    Here's a good URL from one post:

    http://msdn.microsoft.com/library/de.../vbobjcomm.htm

    Looks kinda easy ... assuming you have an electronic device at the other end of your cable that can detect the incoming signals. For that sort of thing, try a regular search on the web. Back when I was looking to do this sort of thing I found there were some really good web sites that gave advice on how to hook stuff up to your computer using the serial (and parallel) port. If I can find any of my old bookmarks I'll post them here too.

  5. #5

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    I thnk I can use the COM port, I'd have to get a new connector, but I guess I could do it.
    <removed by admin>

  6. #6
    Guest
    If you ask me, programming the parallel port in a non standard way is much more easier than using the serial port. Using the MSComm is too much trouble to turn on 3 LEDs as you will need external circuitry to decode the serial data (MAX232). With the parallel port, plug an LED to each (any) pin and you can have control of each pin, whether its a data or control pin.

    I have written a program with this DLL that can access any pin on the parallel if you are interested, and its simpler than you think!

    borris: programming the MSComm control might be easier than the parallel port in some cases, but when you are designing a external circuit to connect to, using the parallel port will simplify the circuit tremendously such as not having to use the MAX232 serial transceiver in the circuit.

  7. #7

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    It's exactly what I needed, with a few modifications of course. Thanks sunnyl!
    <removed by admin>

  8. #8
    Guest

    Smile

    Here you go
    Attached Files Attached Files

  9. #9

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    How can I get an LED to light up like you did? I tried putting it into all the different holes and I checked the first box, and it didn't work. How do I get it to work!?

    Thanks
    <removed by admin>

  10. #10
    Guest

    Smile

    First, you must understand the concept behind the ports of the parallel port.

    Data register (eg, port &H37A) - 8 lines out. This is pins 2 through to 9 in the parallel port connector (D0-D7 in the diagram)

    Control register (port is data register +&H1) - 5 lines out (in the program anyway). This is pins 10, 11, 12, 13, 15 (marked Sx in the diagram).

    Status register (port is data register +&H2) - 8 lines [i]in[/in]. Clicking 'Read' will get the status of those lines. Pins 1, 14, 16, 17.

    All other pins (18, 19, 20, 21, 22, 23, 24, 25) are SG (system ground).

    Just as a first go, shove the LED's +ve into, say pin 2 (D0 line). Now stick the other end into, say, pin 18 (system ground). Start the program, under "Data register" check "Bit 0 (D0, Pin 2)", then click send and the LED should light up. If not, check that your parallel port is at &H378, if not you will have to make changes to the code as it only works with &H378 - no code has been added to the comboboxes click event to change the UDT to other ports).

  11. #11
    Member
    Join Date
    Sep 2002
    Location
    china
    Posts
    55
    Originally posted by
    First, you must understand the concept behind the ports of the parallel port.

    Data register (eg, port &H37A) - 8 lines out. This is pins 2 through to 9 in the parallel port connector (D0-D7 in the diagram)

    Control register (port is data register +&H1) - 5 lines out (in the program anyway). This is pins 10, 11, 12, 13, 15 (marked Sx in the diagram).

    Status register (port is data register +&H2) - 8 lines [i]in[/in]. Clicking 'Read' will get the status of those lines. Pins 1, 14, 16, 17.

    All other pins (18, 19, 20, 21, 22, 23, 24, 25) are SG (system ground).

    Just as a first go, shove the LED's +ve into, say pin 2 (D0 line). Now stick the other end into, say, pin 18 (system ground). Start the program, under "Data register" check "Bit 0 (D0, Pin 2)", then click send and the LED should light up. If not, check that your parallel port is at &H378, if not you will have to make changes to the code as it only works with &H378 - no code has been added to the comboboxes click event to change the UDT to other ports).

    send me sample please !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width