LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multi channels on/off control question

Hi guys,

I have a problem to provide a multiplxer (70 channels) to control which channel to on/off depends on the user input ... lets say the user decide to swith on (close up the relay on) the channels  1, 7, 10; i need to provide a loop to loop through total 3 times (doing something in the loop) and get the input from the channels 1, 7, 10. frankly, i am a C programmer and i am new in LabView, can anyone provide me a guide about how i can do so? I have an idea to build a "for loop" to loop throught the from 0-69; but i can't figure out how can I compare the user input to decide whether this loop is needed to skip or get into ....

Thank you.




0 Kudos
Message 1 of 3
(2,675 Views)

Hello,

I think the heart of your question was: "I have an idea to build a "for loop" to loop throught the from 0-69; but i can't figure out how can I compare the user input to decide whether this loop is needed to skip or get into ...."

I am not sure precisely what you're comparing, but the comparison palette contains functions such as >, <, =, and many others which you can use to compare your data and make a decision.  In order to "decide" to execute your for loop or not, you can use a Case Structure (from the Structures palette - the same place you get the for loop).  You can wire the result of your comparison logic to the case selector, and only one case will execute each time through that piece of code.  In general, the case selector can take many datatypes as input, such as string, enum, integer, boolean, and others.

I think that's what you're looking for.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 2 of 3
(2,655 Views)

PS - if you have arrays of data and would like to manipulate it element by element, you can wire the array into the for loop, and use the indexing feature to have the loop's iterations take the elements in order - when you do this you don't have to wire the the number of iterations to execute (the N input) and the for loop will execute a number of times equal to the size of the indexing array.  You can disable indexing if you want to deal with the whole array in the loop by right clicking on the array's data tunnel leading into the loop.

Best Regards,

JLS

Best,
JLS
Sixclear
0 Kudos
Message 3 of 3
(2,652 Views)