08-30-2023 11:14 AM
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
Solved! Go to Solution.
08-30-2023 11:36 AM
@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.
08-30-2023 11:50 AM
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.
08-30-2023 11:53 AM
This would be best to do with a state machine architecture. Please look around on NI.com for examples of a state machine.
08-30-2023 12:02 PM
@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.
08-31-2023 02:44 AM
@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.
08-31-2023 10:24 AM - edited 08-31-2023 10:25 AM
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.