LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview and NI-DAQ 7.x, outputting to NI-6221 card

I'm trying to use a Labview toggle switch to control a bank of relays (all at once) through an NI-6221 DAQ card. The DAQ Assistant VI will work with a true/false constant in an array, but not with a toggle. Is there a way I can control the DAQ Assistant with a toggle?
0 Kudos
Message 1 of 8
(3,070 Views)
The DAQ Assistant DIO Line Output receives an array of Booleans. If you would like to send a toggle switch to your DAQ Assistant, then all you have to do is wire it through the Build Array.vi (located in All Functions»Array). If you are wanting to write to multiple lines based off of the value of a single toggle switch, then set up all of the lines in the DAQ Assistant and place the toggle switch into a for-loop, where N equals the number of lines you're writing to. Wire the toggle switch out of the for-loop with auto-indexing, which will create an array of Booleans of the proper size, and connect it to the DAQ Assistant.

Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,053 Views)
I wired the DAQ Assistant VI as you instructed, but the VI won't update the boolean status as the switch is toggled. It just outputs the state the the switch was in when the VI was started. Do the switch, the array, and the DAQ Assistant all have to be in a loop of some kind?
0 Kudos
Message 3 of 8
(3,039 Views)
I don't know whether this is relevant to your situation or not, but the control and the DAQ Assistant must be in the same loop if you would like them to update simultaneously. It sounds like that could be your problem. If you still have issues, feel free to post a simplified version of your code (illustrating this feature only) and I'd be happy to take a look at it.

Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(3,019 Views)
It turned out that that was the problem. Thank you for your help.
0 Kudos
Message 5 of 8
(3,010 Views)
I am having a similar problem. I am try to cycle through an array of freqs, and the data is doing as it should but the DAQ assistant stays at the same freq.  Everything is in the same loop, and I can't figure out what's wrong.
 
-Lars
Never underestimate the power of stupid people in large groups!
0 Kudos
Message 6 of 8
(2,858 Views)
Lars,
I'd like to help you out.  Could you post your code, so we can take a look at it?
-Alan A.
0 Kudos
Message 7 of 8
(2,845 Views)
Here it is.
 
-Lars
Never underestimate the power of stupid people in large groups!
0 Kudos
Message 8 of 8
(2,828 Views)