LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure multiple case selector

Solved!
Go to solution

Hello LabVIEW community,


I am currently writing a program to control a rotation stage. Right now I just have a case structure with a True/False statement. If it is false, the rotation stage will move in a defined amount of time steps. If it is true, the stage will move to a defined position. 

Now I want to limit the range in which the motor can move and let it move back to a starting position once a certain threshold is reached. I tried implementing it with just adding a build array and having three cases in my case structure, which did not work, because the third case is only reached if the boolean is on true and the threshold is reached, but I want to implement it in a way, that the boolean just switches between case 1 and 2 and once the threshold is reached it is on case 3 no matter what. 

Thanks in advance,
Karl

Download All
0 Kudos
Message 1 of 7
(848 Views)

@LeoTrotzki wrote:

Hello LabVIEW community,


I am currently writing a program to control a rotation stage. Right now I just have a case structure with a True/False statement. If it is false, the rotation stage will move in a defined amount of time steps. If it is true, the stage will move to a defined position. 

Now I want to limit the range in which the motor can move and let it move back to a starting position once a certain threshold is reached. I tried implementing it with just adding a build array and having three cases in my case structure, which did not work, because the third case is only reached if the boolean is on true and the threshold is reached, but I want to implement it in a way, that the boolean just switches between case 1 and 2 and once the threshold is reached it is on case 3 no matter what. 

Thanks in advance,
Karl


Use Shift register and Enum With Case1,Case2 and Case3 and navigate to different case based on the condition.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 7
(834 Views)

Sorry, I dont think I understand, I am quite new to LabVIEW. I want the VI to have 2 different modes I can switch between, which I already have, where in one mode it moves automatically and one in which it moves to a certain position, but if the threshold is reached it should drop everything and first return to the starting position and then do one of the two modes again.

 

0 Kudos
Message 3 of 7
(821 Views)

This would be best to do with a state machine architecture. Please look around on NI.com for examples of a state machine.




Joe.
"NOTHING IS EVER EASY"
Message 4 of 7
(818 Views)

@Joe_H wrote:

This would be best to do with a state machine architecture. Please look around on NI.com for examples of a state machine.


State Machine


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 7
(811 Views)

@LeoTrotzki wrote:

Hello LabVIEW community,


I am currently writing a program to control a rotation stage. Right now I just have a case structure with a True/False statement. If it is false, the rotation stage will move in a defined amount of time steps. If it is true, the stage will move to a defined position. 

Now I want to limit the range in which the motor can move and let it move back to a starting position once a certain threshold is reached. I tried implementing it with just adding a build array and having three cases in my case structure, which did not work, because the third case is only reached if the boolean is on true and the threshold is reached, but I want to implement it in a way, that the boolean just switches between case 1 and 2 and once the threshold is reached it is on case 3 no matter what. 

Thanks in advance,
Karl


A boolean case can only ever have 2 states. You need to change that to a numeric so you can have more, and as suggested make it an Enum for named states and readability.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(763 Views)
Solution
Accepted by topic author LeoTrotzki

That would not really be what I want, because I do not want to choose to move it back to its starting position. I implemented the wheel in a experimental setup, where it was supposed to be done automatically, but after a while of thinking about it, I figured out, that I do not really need a button for it to move to a certain position, because I could always do that with the starting position. 

So now I have automated it in the experimental setup.

I will look into state machines etc., but this had to be done somewhat fast, because I only have limited beam time.

0 Kudos
Message 7 of 7
(729 Views)