Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital I/O why can't I have line outs and line ins in the same application?

I have a problem with my digital lines. I have several "write to digital line" VIs, and I also need some "read from digital line" VIs. My problem is that when I supply 5V to the line in, it doesn't register high. I checked this on a separate program, and when I did not have a "write to digital line" , the "read from digital line" was at 5V (I checked it with a multimeter). As soon as I included a "write to digital line" in the program, the input was jumping around 1.3V. What is the problem here?
0 Kudos
Message 1 of 4
(2,881 Views)
Hello,

Are you reading and writing to digital lines within the same port? If so, using the "Write to Digital Line" and "Read from Digital Line" VIs are the problem. These are higher level VIs. If you open them, you'll see that each one first executes a port config which resets all the lines. To fix this, leave the first read or write VI alone and in all subsequent ones, wire a positive number to the iteration input. For further information,
  1. Go to http://www.ni.com and click on Support at the top.

  2. In Option 3, select KnowledgeBase from the Search box and type "read write digital line" (without quotes).

  3. The first link returned should be How Can I Read and Write Concurrently To/From a Digital Port Using Read/Write from Digital Line with....



If this does not answer your question or you still have problems, feel free to post again. Please include some more information such as the version of LabVIEW you are using and which DAQ card you have.

Grant M.
National Instruments
0 Kudos
Message 2 of 4
(2,881 Views)
To my knowledge, I am not doing anything with a port. Maybe that is my problem, I do not know. I have attached the portion of my application that I am having problems with, if you could take the time to see what I am doing. If I have just the dio "Write to digital line" VIs everything works fine, or when I have only the "Read from digital line" VIs everthing works fine. When I have them both in the same application is when the trouble starts.
0 Kudos
Message 3 of 4
(2,881 Views)
Hello,

I apologize for the delay in responding to your question. You are writing to digital channel 0. This is the same thing as digital port 0. A port is simply a collection of digital lines. Since you are reading and writing to lines 0-7 on channel 0, the Write to Digital Line and Read from Digital Line VIs are resetting the state of the port every time they are called. I notice you have wired a 0 to the iteration count of all the write VIs, but nothing to the read VIs. To fix this problem,

  1. Wire a 1 to the iteration input of all the write VIs except for one. This last VI you can either wire a 0, or leave it unwired as 0 is the default.

  2. Wire a 1 to the iteration input of all the read VIs.



I have m
odified your VI in this way and attached it below. Ideally, you would want to write to a line with 0 for the iteration count only once (outside the loop). The modified VI will do it at the beginning of every loop iteration. I have tested it here and it seems to work without problems. The reason for the modification is that both the high level read and write VIs reset the port when they are called unless you wire a nonzero number to the iteration input. This effectively tells the VI that the port has been initialized and it can skip it.

Feel free to post again if you have further questions. Happy coding,

Grant M.
National Instruments
0 Kudos
Message 4 of 4
(2,881 Views)