03-10-2011 05:08 PM
I have a voltage measurement (NI 9274) which is wired to two separate (>) and (<) both of which have the same constant. So, if the voltage measured is <, then, it sends TRUE to case structure 1 and FALSE to the other. If the voltage measured is >, then, it sends TRUE to case structure 2, and FALSE to the other. In this way, only one case structure operates per one voltage measurement. The case structures command NI 9211 digital output module. The intention is for the measured voltage to be used to select one or the other case structure for the digital output.
When you change the input voltage, you should be able to see the appropriate case structure give the 9211 the command. However, instead, the vi does NOT switch in between case structure outputs as you vary the input voltage. Why not?
03-10-2011 05:23 PM
THere are lots of things that are wrong with your code. First and foremost, DO NOT use mutually exclusive parallel case structures. This is a ridiculous code construct. Simply put the code from the TRUE case of one of the case structures into the FALSE case of the other and delete the one you moved the code from. In addition, your output from the compare is not a boolean which the case structure is expecting. It is a cluster that contains a name, a start time, a time stamp, an x and a y value. A Case structure requires either a boolean, a string or an integral value (ENUMs are integral values). You cannot wire a cluster or a floating point number to the case selector. So, in addition to eliminating one of your case structures by combining them you also need to change your comparison to compare only the single axis value (your voltage) with your constant and use that boolean result to select either the TRUE or FALSE case.
03-10-2011 05:56 PM
Thanks so much for your help. I understand about putting the two codes into the same case structure, but, what about when I have 3 or more cases? Is it OK to use parallel case structures in that case?
I am confused about one point you make. You say that the output to the case structure is not boolean? Is all that other data passing through the < to the case structure? I thought it was boolean because the output from the < and > are boolean, returning TRUE or FALSE.
"cluster that contains a name, a start time, a time stamp, an x and a y value"...where is all this coming from? How do you see that all those are going into my < and >? Where can I see those, and eliminate the ones that I don't want? I want only the voltage value, of course, in mV.
Thanks again for your help.
03-10-2011 06:23 PM - edited 03-10-2011 06:25 PM
I should have said the output of the compare. Sorry about that. There are better ways to handle selection than to use parallel case structures.
Here are a few examples of how you can make your selections.
You can use the unbundle by name to retrieve the value that is your voltage and wire that to your comparison.