12-10-2009 06:04 AM
Hello everyone!
I'm using a state machine (look at pic), but I want to select the next state depending of a comparison with a integer (1,2,3,4,5). Well, I don't know how to select the diferents next states, because with de <<select button>> (comparison express), I only can select 2 posibilities. I think there is other one button to do this but I don't know what. Are there others posibilities to do this?
Thanks!!
Joselito!
Solved! Go to Solution.
12-10-2009 06:33 AM
You can just connect a case statement up to the output of your subVI.
p.s. It's never a good idea to do equal comparisons with floating point numbers.
12-10-2009 06:39 AM
You could place the states in an array and index the the array. In your case you will need a -1 as we start counting with 0.
Felix
12-10-2009 07:03 AM
Hello Dennis Knutson,
I don't understand what you refer. I only have a output, which can be from 1 to 5 (so I'm using the equal comparisons with integer, because all the outputs of my subVI are integers). The subIV I'm using is a example for N button dialog from Labview 7, and I can't modify it. I'd like doing something in the way I'm doing. Any suggestions?
12-10-2009 07:20 AM
Simply place a case statement on your block diagram. Connect the integer output of the subVI to the case selector.
You can wire integers, strings, enums, and Booleans to a case statement.
And you are NOT using the comparison function with integers. Integers are colored blue. You should check out the free LabVIEW tutorials.
12-10-2009 07:21 AM
Wire the output of the N button core SubVI to the selector of a case structure. Place the next state enum inside of the case.
12-10-2009 07:56 AM
Thanks everyone!!
I think I'll try to connect like sgregor249 says, because it's easy and I tried something like this and worked. Thanks for all, really. I should study some tutorial, but I haven't got much time to do this project.
Thank you again.
12-10-2009 09:53 AM
Joselito wrote:Thanks everyone!!
I think I'll try to connect like sgregor249 says, because it's easy and I tried something like this and worked. Thanks for all, really. I should study some tutorial, but I haven't got much time to do this project.
Thank you again.
Which is exactly what I told you to do in the first response.
So you have time to ask the board some really basic questions but you don't have time to learn it for yourself?
12-10-2009 11:22 AM
I'm sorry Dennis Knutson,
I didn't know It was a basic question. I did exercises from a manual and It didn't help me too much, so I had prefered begin doing these things. Anyway I'm going to review the tutorial you said me before asking something. I'm really sorry, sometimes I need a slap on the wrist...
Thanks for all.
12-10-2009 11:29 AM
Joselito wrote:I didn't know It was a basic question. I did exercises from a manual and It didn't help me too much, so I had prefered begin doing these things. Anyway I'm going to review the tutorial you said me before asking something. I'm really sorry, sometimes I need a slap on the wrist...
Keep participating in the forum. You will learn a lot very soon. Took problems from others, solve on your own and compare it with other posts in that thread and you will get better and better approaches.
All the best.