LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Outport.vi doesn't seem to change parallel port register values

Hello, 
So I am trying to use the parallel port on my computer to control a set of logic gates on a PCB. I am using the outport.vi with it wired to my X0378 port and feeding it 8 bits at a time to carry out the nessecary logic operations. The bit I am getting from a text file and there doesn't really seem to be any problems with that part of the vi. The problem arises when trying to pass the data to the parallel port register. It seems that for whatever I pass it the output from the computer is always logic high (5V) for the ports I am trying to use (2-9) on the d sub connector. I have tried using the example port programs provided by Labview and have yielded the same results. The weird thing is that last week I ran this program on Friday and everything seemed to work fine. I was able to cycle through a list of vectors with no problem and everything on the board worked. However, now nothing works and I can't figure out why. The fact that the port doesn't work across different vi leads me to believe its something hardware related, but then again I didn't change any hardware settings from last week. Any help would be greatly appreciated. 

 

I am using Labview 2011 and windows xp 32 bit

Download All
0 Kudos
Message 1 of 9
(3,783 Views)

Hi jag213,

 

After looking at your code, it looks like we have some data representation issues. I would recommend double-checking all of these data types (I8 and I16 throughout) are correct and then continuing in your troubleshooting:

1. For your Scan Value function, create a constant, change representation to I8 and wire it into your data type terminal. Make sure that the formatting string is still %b.

2. You'll notice you still have a coercion (red dot) into your Out Port.vi. Delete the U16 data conversion function and wire the broken wire to itself. Now there is no coercion dot for Out Port. Numeric 3 should be changed to I8 as well.

3. When I downloaded your VI, the Address custom control did not load, but in the version I open it appears to have U32 representation. It should be I16.

 

Let's see if cleaning up the data representation to be consistent with the Out Port calling conventions eliminates any issues.

 

What other steps have you done to troubleshoot? Are you able to see your parallel port in Measurement & Automation Explorer?

 

You may also want to check out this KB.

 

Let's figure this out!

 

 

 

 

 

Joey S.
Senior Product Manager, Software
National Instruments
0 Kudos
Message 2 of 9
(3,728 Views)

Hello Joey,

Thank you for responding. I changed the data types so that there were no coercion dots but that didn't seem to do the trick. I've read and reread that page you posted many times. It is actually from there that I got the starting code to write to the port using outport (which is why my data types were u32 and u8 as shown in their code). As far as the measurement tools, I can see the port and it says it is working properly. I have gone through the process to check if the parallel port is working http://digital.ni.com/public.nsf/allkb/608BBECBD3A792AA86256ECC007EC828

 The test ran test fine where you drive the normally logic high pins to gnd using a wire. I see the LEDs change when driven low.

 

For some reason I can't use any Visa commands for the parallel port which is why I am using outport. I have tried using the example parallel.vi  program provided on the page you linked. I get the following error (attached). Don't mind the first two those are just from when I closed MAX. I had pins 11 and 12 ground like it said in the link. 

 

 

 

I am pretty sure my visa drivers are up to date. 

Once again thanks for taking the time to help, any advice is appreciated. 

 

0 Kudos
Message 3 of 9
(3,706 Views)

Hello,

 

You mentioned that your program was working before, what has changed since then? Have you been able to communicate using the Test Panels in Measurement and Automation Explorer? The Test Panels can be found by right clicking on your device in MAX and selecting "Test Panels..." You may have to configure the test panel to be compatible with your instrument.

 

Jason D.

Applications Engineering

National Instruments

0 Kudos
Message 4 of 9
(3,684 Views)

I never actually change anything. If I get it to work it will work until I restart my computer and then labview no longer seems to be able to control the ports. I got it working once today and I did not change any code. Before it worked, I had the parallel port hooked up to a breadboard to see if I could light up some LEDs in the right order. I don't know if grounding certain pins causes the computer to relinquish control of the port for Labview to use, until the computer is restarted. Whatever the case, there is no consistency between when it works and when it doesn't. 

0 Kudos
Message 5 of 9
(3,669 Views)

What do you need to do in order to get it to work? Are you able to use the Test Panels in MAX? It would also be helpful to know what the expected results are and the actual results. Also, I wanted to let you know that the Scan Value function has an input that allows you to decide the data type of the output. It is the terminal labeled "default (0 dbl)."

0 Kudos
Message 6 of 9
(3,648 Views)

I don't really know what I have I do to get it to work. It just seems like sometimes it will work and sometimes it does not. The times it actually works are few and far between and seem pretty random. Whatever the case I don't think I have ever actually changed anything in Labview and had it working all of a sudden. It has always been from playing around with the parallel port itself. This invovles trying to light up an LED array on a breadboard and grounding various pins. I am not really sure how to use the test panels in MAX everything seems to be for serial and I don't really know how to configure the parallel port since it seems pretty basic. Max does say that everything is working fine. My scan value is to tied to %b to get the binary value from the string. 

 

As far as expected values vs. actual results; when it works it I am seeing my text file string of binary values at the output of the parallel port (D2- D9). When it doesn't work the parallel remains locked at some value usually all logic high but not always. However it is definitely not the input string of binary values.  

0 Kudos
Message 7 of 9
(3,628 Views)

Are the numerics in your code and the string showing the expected data before sending that data to the Out Port.vi? If you could simplify your code to write one value, and replace your wait VI with the one found by navigating through Programming >> Timing >> Wait, it may help with narrowing down where the problem is occurring.

0 Kudos
Message 8 of 9
(3,606 Views)

Just for future people looking in on this I was able to finally control the port by changning the port setting in the computer bios to SPP 

Message 9 of 9
(3,541 Views)