ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed State machine

Hi all,

In this VI I have to insert the total time of my test, the time of a waiting time once the test is started and the time of the recording.

So if "total test time" = 35s, "Time to record" = 5s and "Time to wait" = 10s I want to see 2 whole cycles unless I press the reset button or stop button before 30s.

I cannot understand how I can STOP immediately in every state of the state machine.

Can anyone help me? Thanks

 

0 Kudos
Message 1 of 4
(1,330 Views)

Hi Luka,

 


@Lucky-Luka wrote:

I cannot understand how I can STOP immediately in every state of the state machine.


Comments:

  • There should be no While loops inside the states. You already have a loop around the whole statemachine, that's all you need…
  • The STOP button can be read in/before each case, there's no need for the event case in the IDLE state…
  • Using the event structure is tricky, especially when you lock the frontpanel until events are handled…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,283 Views)
  • Don't put a While loop around your timers.
    • Use "Time Has Elapsed" to go to the next state or stay in the timer state
  • You really only need one timer or "wait" state 
    • Pass the time to wait to the timer state from the previous state
  • Don't put an Event Structure inside a state. 
    • Use polling or events to read controls not both
========================
=== Engineer Ambiguously ===
========================
Message 3 of 4
(1,247 Views)

Maybe this can give you some ideas....

 

altenbach_0-1704925623360.png

 

 

 

0 Kudos
Message 4 of 4
(1,219 Views)