04-19-2015 06:15 PM
Hi all
I have a varying voltage which I will feed into a case structure. Is it possible to implement the case structure as follows.
If input to case is between 1.238 and 1.242, output = STRAIGHT
If input to case is less than 1.238, output = LEFT
If input to case is greater than 1.242, output = RIGHT
Thanks
Greg
Solved! Go to Solution.
04-19-2015 06:51 PM
Yes it is possible. There are numerous on-line instructional material for LabVIEW -- after the first one, you should be able to solve this problem yourself. If you do it yourself, it will "stick" with you. Put some effort into this yourself, then come back when you have a real question.
BS
04-19-2015 06:53 PM
You can't use floating point numbers in a case structure directly however there is no reason you can't use the comparion primitives to achieve this task.
This is a very fundamental question - I recommend looking through the online tutorials as well to increase your overall LabVIEW knowledge.
04-19-2015 08:03 PM
04-20-2015 04:00 AM
Thanks all
gonna tackle it now....will be back with any issues (real issues )
Regards
Greg
04-20-2015 05:31 AM
Hi
I have tried to remove the floating point. I am using a daq assistant to acquire the signal and I cant see how I can change it before it leaves the daq assistant.
I have scaled the number up after leaving the daq assistant to an integar and selected ranges to suit, but the program wont accept this. (the ranges appear in red)
It will however accept the same ranges if I wire a numeric control to the case selector.
I have viewed the scaled up number on a numeric indicator and it is an integar that suits the ranges in the case structure.
I have atached an image of my code also.
Thanks
Greg
04-20-2015 05:37 AM
As was mentioned earlier, you can't use a double precision variable as a case selector. You'll need to convert it to integer (numeric>conversion) first
04-20-2015 07:31 AM
Many thanks for all the pointers....The help was really appreciated
Regards
Greg
04-20-2015 07:39 AM
04-20-2015 10:33 AM
Greg,
Because you marked this post as "Solved", I'm assuming you have code that does what you need. I hope that it looks something like this (perhaps with Case Statements instead of Select functions). You stated the problem in terms of Greater Than or Less Than conditions, so it might help "transparancy" if these relationships appear in the code directly, as is shown here. Note also that the Output will be one of three values of the Straight/Left/Right enum that I defined by putting an Enum control on the Front Panel, right-clicking it, choosing Edit, and simply creating these three values.
Bob Schor