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?
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?
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.
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.
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!?
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).
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).