Jump to content

How do I write out the parallel port?


Recommended Posts

You can use your parallel port as a free little DIO card! You get eight bits of output and five bits of input.

If you can determine which address your port is using, it is a simple matter to use the "In Port.vi" and "Out Port.vi" (except on WinNT) to read from and write to your parallel port. WARNING!!! Be careful not to short anything out, as this port is built in to your computer, and inadvertently touching the wrong pins together for just a millisecond can destroy your port! These pins, as output, can only drive a tiny amount of current, so you would need additional circuitry to drive relays. I recommend buying a parallel port card, which are only about $20, just to be safe.

First, you need to determine the port's I/O address. In Win95, right-click on "My Computer", select Properties, then select the "Device Manager" tab. Click on the + sign next to Ports, the double-click on any "Printer Ports" you see. Clicking in the Resources tab of the window which comes up tells you the I/O range, in hexadecimal. For the more primitive Windows, try these addresses (all hexadecimal): 0x378, 0x278, then 0x3bc.

Once you know the port's I/O address, "In Port.vi" reads eight bits, and "Out Port.vi" writes eight bits. Take advantage of LabVIEW's ability to display any numeric in hexadecimal format (under the "Format & Precision" menu) and show the radix on your numbers lest you forget. Show the address as hexadecimal, and the data as hex, octal, or binary, for easier interpretation.

Here is the relationship of pins to bits on the 25-pin connector: Pins 2 through 9 correspond to output bits 0 (LSB) through 7 (MSB). Pins 15, 13, 12, 10, and 11 correspond to input bits 0 (LSB) through 4 (MSB). Pin 11 in inverted. Most connectors manufactured today have tiny pin numbers embedded in the plastic next to the pins.

If you want to know more, there are plenty of parallel port FAQ's on the internet.

During the power on self test (POST) some BIOSs scan ports to check to see if they're installed. On one machine I had the situation where the external hardware was setting the IO lines such that the BIOS was not seeing the port (hence LPT 1 was not installed and no printing was possible). If this happens, make sure that your external hardware is disconnected when you reboot the machine.

Credit: Bruce Mihura, Nick Moulton

Link to comment
  • 2 years later...
You can use your parallel port as a free little DIO card! You get eight bits of output and five bits of input.

If you can determine which address your port is using, it is a simple matter to use the "In Port.vi" and "Out Port.vi" (except on WinNT) to read from and write to your parallel port. WARNING!!! Be careful not to short anything out, as this port is built in to your computer, and inadvertently touching the wrong pins together for just a millisecond can destroy your port! These pins, as output, can only drive a tiny amount of current, so you would need additional circuitry to drive relays. I recommend buying a parallel port card, which are only about $20, just to be safe.

First, you need to determine the port's I/O address. In Win95, right-click on "My Computer", select Properties, then select the "Device Manager" tab. Click on the + sign next to Ports, the double-click on any "Printer Ports" you see. Clicking in the Resources tab of the window which comes up tells you the I/O range, in hexadecimal. For the more primitive Windows, try these addresses (all hexadecimal): 0x378, 0x278, then 0x3bc.

Once you know the port's I/O address, "In Port.vi" reads eight bits, and "Out Port.vi" writes eight bits. Take advantage of LabVIEW's ability to display any numeric in hexadecimal format (under the "Format & Precision" menu) and show the radix on your numbers lest you forget. Show the address as hexadecimal, and the data as hex, octal, or binary, for easier interpretation.

Here is the relationship of pins to bits on the 25-pin connector: Pins 2 through 9 correspond to output bits 0 (LSB) through 7 (MSB). Pins 15, 13, 12, 10, and 11 correspond to input bits 0 (LSB) through 4 (MSB). Pin 11 in inverted. Most connectors manufactured today have tiny pin numbers embedded in the plastic next to the pins.

If you want to know more, there are plenty of parallel port FAQ's on the internet.

During the power on self test (POST) some BIOSs scan ports to check to see if they're installed. On one machine I had the situation where the external hardware was setting the IO lines such that the BIOS was not seeing the port (hence LPT 1 was not installed and no printing was possible). If this happens, make sure that your external hardware is disconnected when you reboot the machine.

Credit: Bruce Mihura, Nick Moulton

Hi FAQ Moderator,

And I can control the parallel port data out, can control my relay open and close normally, but it can't read digital signal, for example +5v signal,and I use "in port.vi" to read the signal status, connect the signal to the pin10 or between the other 10 to 15 (except pin12) pins, and ground, but hasn't any result feedback, any wrong or focus that I should pay attention to ?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.