LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Visit our LabVIEW Wiki Hardware Portal


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> How do I write out the parallel port?
KB Moderator
post Apr 8 2004, 03:06 AM
Post #1


One hit wonder!
Group Icon

WIKI Moderator
Posts: 1
Joined: 3-April 04
Member No.: 338
LV:7.1


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


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Apr 8 2004, 03:06 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Cool-LV
post Aug 11 2006, 04:07 AM
Post #2


Very Active
***

Member
Posts: 101
Joined: 10-April 06
Member No.: 4703
Using LabVIEW Since:2003
LV:8.5 ,8.2.1 ,7.1
China United States United Kingdom


QUOTE (FAQ Moderator @ Apr 8 2004, 03:06 AM) *
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 ?

--------------------
Best Regards!


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 8th January 2009 - 08:13 PM