From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change control while statemechine running

Hi

 

In my simple carwash program i need some solution.

 

when we press deluxe button program should run all the 5 steps.

for economy program should run 2,3,4 steps.

 

while running in steps if Out Position switch is on, program should check the timeout condition.

when timeout condition satisfied program should exit.

 

here some functions working fine.

we have problem is that while executing the steps i need to change the position of the Out position switch.

it doesnt work till all the steps to complete.

 

how to solve any solution please.

 

Regards,

hari

0 Kudos
Message 1 of 2
(1,846 Views)

Hi Hari,

 

The reason the switch is changing only after the loop is finished is because you've inserted a while loop inside the event structure.

 

If you've already done embebbed programming, the event structure is like an interruption, you are not supposed to make big actions as loops inside the structure.

 

What you have to do is to take the statemachine outside the event structure. In fact, you don't even need two state machines, you can make only one and do the steps depending on the option you've selected (try to add a "WaitBegin" or something state in your machine and, depending on wich button is pressed, you start in bool1 or bool2 state. In bool4, you check based in which option you've selected if you want to go to step 5 or go back to Waitbegin state - Select function in comparison pallete will be useful for this).

 

Untitled.png

0 Kudos
Message 2 of 2
(1,837 Views)