Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
94 ratings:
 3.65 out of 5   

Setting Individual Bits for the Parallel Data Port Using LabVIEW



Primary Software: LabVIEW Development Systems>>Full Development System
Primary Software Version: 6.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
How do I set individual bits for the parallel data port using the In Port and Out Port VIs in LabVIEW? Also, how do I set a bit on the 8-bit register without updating the rest? I receive error 21 or error 37 when using the Serial Port Write or Serial Port Read VIs to control the parallel port on Windows NT.

Solution:
Pick the address of the port you want to write to (such as 0x3BC), write to the register you want to update (such as data lines, status lines, control lines), and use the Out Port VI to send the byte.

To set a bit on the 8-bit register without updating the rest, set a mask and change just the bits you are interested in changing (turning on/off). You also need to read from the register and update it with the mask and changed values. Refer to the attached Parallel VI (in the parallel.llb within Parallel.zip) for an example of masking the port; use it instead of the Out Port VI and specify the bit and the Boolean value .

To get the data lines working correctly, ground the BUSY and PE lines. These are pins 11 and 12, respectively. These are both handshaking lines and left unwired, these lines indicate that the printer is busy or out of paper. Grounding these inputs communicates to the parallel port that the device is ready to accept data.

Refer to KnowledgeBase 0TL70ATL (linked below) for more information about using the parallel port.

Windows 2000/NT:
Use the parallel_NT.llb example (also found below within Parallel.zip) because you cannot use the In Port and Out Port VIs on Windows 2000/NT. Install the accessHW files by running setup.exe to make direct access to memory available on Windows 2000/NT. Refer to KnowledgeBase 0TL70ATL (linked below) for information about using the parallel port pins through direct memory access.

Note: This example was developed and tested by a National Instruments Applications Engineer for technical support purposes. This code is supported by National Instruments, but might not be completely tested and verified with each new revision of related products and drivers.

Related Links:
KnowledgeBase 0TL70ATL: Using the Parallel Port as an Input/Output Channel


Attachments:


Parallel.zip - Parallel.zip



Report Date: 04/27/1998
Last Updated: 06/11/2007
Document ID: 18QGBH0O

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit