Hey all so I'm very new to LabVIEW and I'm trying to do a simple program.
Right now I'm have a numeric control which controls my analog input voltage on my sbRIO 9636 board(from the evaluation kit). Depending on the voltage I want to display a message onto the LCD screen. I know that you cannot use FXP values as case selector values. Is there any way around this? I was thinking about converting it into string, but I want to have a case where any voltage between 0-1 displays a message, then 1-2 displays a different message and so on and so forth up until 10.
已解决! 转到解答。
Yeah I figured it out once I got on my computer that had LabVIEW on it..
I have another problem.
I have a case structure with a bunch of cases and an integer case selector.
I want to be able to display a message for each value. Between 0 to 1 volts would display "zero" and between 1 to 2 volts will display "one" etc. But the case structures rounds up my values, so anything that is >=1.5 will be automatically thought of as 2. >=0.5 is thought of 1. How can I get around this?
The rounding in the case selector is built-in and cannot be changed by the programmer. You will need to do the logic externally and create the integer selectors you need. One way to do this is to create a constant array with the values where you want to switch cases. Then do a comparsion to the variable value. Search the resulting boolean array for the first True. The Index coming form the search goes to the case selector.
Lynn
@butterwaffle wrote:
I want to be able to display a message for each value. Between 0 to 1 volts would display "zero" and between 1 to 2 volts will display "one" etc. But the case structures rounds up my values, so anything that is >=1.5 will be automatically thought of as 2. >=0.5 is thought of 1. How can I get around this?
If you are keeping with the integer numbers as the limits, just use Round to -Infinity to round down to the nearest integer and wire the result into the case selector.
@johnsold wrote:
I knew there was an easier way I was missing!
Lynn
The next simplest way I was thinking was using the Threshold 1D Array and then round the resulting index to -Infinity. That would work well if the limits are not integers.
Yep I found the Round to -Infinity in the numeric pallete! Thanks for the help all.