LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Read/Write Parallel port

I need to write to several different pins of the parallel port and then read back 2 different signals simultaneously.  inp and outp do not seem to give me the capability to do this.  Any help is appreciated
0 Kudos
Message 1 of 11
(5,987 Views)

Hello Clayton,

 

I would recommend using NI-VISA to communicate with the parallel port.  When you install this API, be sure to select support for LabWindows/CVI in order to obtain the VISA library.  You may want to check if you already have this support by determining whether the VISA library is presently available to you.  Your parallel port will be mapped to a resource string that you can use with the VISA functions.  This resource string can be found in Measurement & Automation Explorer.

0 Kudos
Message 2 of 11
(5,967 Views)

I have the VISA library installed.  Are you referring to the viWrite and viRead functions to accomplish communicating with individual lines on the parallel port?  How would I set the parameters? 

 

Could I use WriteToDigitalLine and ReadFromDigitalLine functions?  Thanks 

0 Kudos
Message 3 of 11
(5,957 Views)

See the link below, it may help:

 

http://forums.ni.com/ni/board/message?board.id=180&message.id=29526#M29526

 

Also, the parallel port mode may be important. You can check and change it from your PC's BIOS.

Try changing it to "Output Only" or "Bi-directional" according to your application.

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 11
(5,950 Views)

Thanks you for the reply, this may work.  If I need to send a logic 1 on pin14 of the parallel port I would just use "outp (0x378, 0xD)"?  Does this explicitly set all of the other channels to 0? 

 

I also need to read pins 12 and 13 simultaneously after sending the logic 1 on pin 14. Can I do this with inp?  I really appreciate the help

0 Kudos
Message 5 of 11
(5,947 Views)

Hi Clayton,

That's NOT correct. The output pins of the parallel port are between 2(lsb) and 9(msb).
You cannot control pin 14 as ouput and I thnik you misunderstood the connection between the data (the second parameter to the outp function) you write and the pins effected.

The data byte is 8 bits and each bit correspond to a pin from 2 to 9. So writing 0x0D = "0000 1101" to the port will send a logic 1 to pins 9,7 and 6.
The attached drawing may help to clarify further.
I also recommend a little reading from the internet. You can start with: http://logix4u.net/Legacy_Ports/Parallel_Port/A_tutorial_on_Parallel_port_Interfacing.html

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 11
(5,928 Views)

BACLI,

 

 

I am working on Porting project from Windows 95 to XP platform.

 

In windows 95, we had used CVI 4.0 for developing the test application, in which we used outp and inp functions to communicate with parallel port.

 

will same outp and inp functions can communicate with parallel port directly under XP with CVI7.0? If not, Do I need to write any low level driver application to bridge the gap between inp&outp functions to parallel port? and one more thing I haven't loaded any external low level drives in my present code but still CVILowLevelSupportDriverLoaded () function is returning "1". your help is really needed to move forward.

 

Regards,

Ramesh

email ID: ramesh.meka@Honeywell.com, please forward your reply to this email ID.

0 Kudos
Message 7 of 11
(5,270 Views)

Hi Ramesh,

The CVILowLevelSupportDriverLoaded() function should return a 1 if the driver is loaded, and the driver should be loaded automatically by CVI at startup, if the driver is present on the system. Since the driver is present, you should be able to call the inp and outp functions in your code. Have you been able to test this yet?

 

Best Regards,

 

John M

National Instruments
Applications Engineer
0 Kudos
Message 8 of 11
(5,217 Views)

Yeah John....It's working now....I could able to communicate with parallel port with inp and outp functions. Thank you so much for your inputs.

 

 

Regards,

Ramesh

0 Kudos
Message 9 of 11
(5,202 Views)

Hello

 

i need to read and write the parallel port. In the past we use the LPT on board and so was enought read the 0x378 addres with inp.

 

Now we dont find anymore PC with onboard LPT and we need to add one PCI card with LPT, but the addres is not more 0x378.

 

How can i read the LPT status and write direct to the port ?

 

Thanks

0 Kudos
Message 10 of 11
(5,192 Views)