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
(3,558 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
(3,551 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
(3,545 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
(3,513 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
(3,505 Views)

Works Great, Thank you, big help.

0 Kudos
Message 6 of 6
(3,482 Views)