LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

interrupt states in a state machine

Solved!
Go to solution

You find in the attachment two versions of my work : the first one with QMH and the second one with simple state machine

So i want doing the following process :

1--  i clic on "start measurment button", the state machine executes seq1 until seq4 normally unless i didnt clic on "stop measurement button" . i want when i press on "stop measurment button" the state machine interrupts the execution of the sequences and executes the "stop device state" and then returns the wait for user event state.  

2-- i want to calculate the execution time of every state of my state machine

3-- i want that the current time to be dynamic  and  not fix 

Plz heeelp 

Download All
0 Kudos
Message 1 of 4
(971 Views)
Solution
Accepted by topic author JASMIN185

What happens in the sequences steps? Currently you cannot abort during a state, just between states.

 

You can update the time display if each state uses the outer loop until a time has elapsed to go to the next state (or idle if the process is interrupted). If you want a continuous time display, it needs to be in a separate loop with a reasonable constant loop time.

 

A quick band-aid fix would be to pass the state through a select function before the case structure and switch to idle if the a button ins pressed. (f each state calls a lengthy subVI, you can jump through some flaming hoops with references to the time display, but I would not recommend that)

 

Get rid of the event structure!

0 Kudos
Message 2 of 4
(955 Views)

* in the sequences steps i send configuration to the instrument and i wait for it to finish calculating the leaking current and i display the result in the front panel . the same process is repetaed with seq 2 , 3 and 4 . parametres is the only thing that make diffrence betwwen sequences . and YES i want to ABORT the state execution once i clic on stop measurment button because every sequence state takes time ( about 1:30min) to finish executing

** i put the time display in a separate loop but once i clic on exit button the labview program continue its execution ( see image bellow )

***f each state calls a lengthy subVI, you can jump through some flaming hoops with references to the time display, but I would not recommend that) can u explain more ? 

thank youu 

0 Kudos
Message 3 of 4
(918 Views)

Put an event structure with a 500ms timeout and stop value changed event in the small loop and it will stop too.

 

altenbach_0-1652827196412.png

 

0 Kudos
Message 4 of 4
(913 Views)