LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

select between more than two to next state

Solved!
Go to solution

 

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!

0 Kudos
Message 1 of 10
(3,611 Views)
Solution
Accepted by topic author Joselito

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. 

0 Kudos
Message 2 of 10
(3,603 Views)

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 

0 Kudos
Message 3 of 10
(3,598 Views)

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?

0 Kudos
Message 4 of 10
(3,585 Views)

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.

0 Kudos
Message 5 of 10
(3,570 Views)

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.

 

 

Download All
0 Kudos
Message 6 of 10
(3,568 Views)

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.

 

0 Kudos
Message 7 of 10
(3,540 Views)

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?

0 Kudos
Message 8 of 10
(3,514 Views)
 

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.

0 Kudos
Message 9 of 10
(3,496 Views)

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. 

0 Kudos
Message 10 of 10
(3,493 Views)