From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting channels with a Boolean control

Solved!
Go to solution

I want to have a list of Boolean controls that represent each of the channels for a particular module. I have it so that the program will combine everything, just if you deselect any of the channels out of order it will not correct the channel string. IE with channels 0 through 5 selected I get cDAQ1Mod1/ai0:4, if Channel 2 is deselected I get cDAQ1Mod1/ai0:3. I need it to send out cDAQ1Mod1/ai0, cDAQ1Mod1/ai2:4. I am using a cDAQ-9172  4 bay Chassis with Labview 17. Here is a copy of the test program that will get put into the main program later when the problem is fixed. Thanks in advance.  

0 Kudos
Message 1 of 6
(2,986 Views)

I can't see your VI (I'm on LV 2016), but I would just ditch the colon syntax. This will be much easier to code up than trying to figure out how many channels in a row are selected.

 

So Channels 0 to 2 would be:

Mod/ai0, Mod/ai1, Mod/ai2

 

Channels 0 and 2 would be:

Mod/ai0, Mod/ai2

0 Kudos
Message 2 of 6
(2,979 Views)
Solution
Accepted by RL69

Dig into the DAQmx->DAQmx Advanced->DAQmx Utilities palette.  There is a nice function in there for you: DAQmx Flatten Channel String.  The idea is that you build up an array of your channels and pass the array into that function and out will come a string that gives you what you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 6
(2,973 Views)

I think that this will work. could you please send me this as a vi. I am still relativity new to LabView. I cannot quite figure out how to get everything you have into my program. Thank you. 

0 Kudos
Message 4 of 6
(2,941 Views)
Solution
Accepted by RL69

@RL69 wrote:

I think that this will work. could you please send me this as a vi. I am still relativity new to LabView. I cannot quite figure out how to get everything you have into my program. Thank you. 


That image is a snippet.  Save that image to your computer and then drag it onto your block diagram.  Instant code!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,933 Views)

Works Great, Thank you, big help.

0 Kudos
Message 6 of 6
(2,910 Views)