LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine with timed loop?

Solved!
Go to solution

Hi everyone,

 

Is it possible to have a state machine with timed loop? i.e. on the last state, we wait there until the end of the period to change back to the initial state again.

 

Thanks

0 Kudos
Message 1 of 8
(5,733 Views)
Solution
Accepted by topic author crazycompgeek

crazycompgeek wrote:

Hi everyone,

 

Is it possible to have a state machine with timed loop? i.e. on the last state, we wait there until the end of the period to change back to the initial state again.

 

Thanks


 

Yes.  However, when the loop is running, there will be no way to stop the program or to do any other action.  But if that is what you want, yes it is possible.

 

 

- tbob

Inventor of the WORM Global
Message 2 of 8
(5,722 Views)
I use a "Wait" state in my State Machines; it loops through the Idle state for a predetermined time then continues.  This allows the program to respond if there's any action on the Front Panel.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 8
(5,688 Views)

 

In the picture below, sequence named "first" stay for five minutes and then move to "second" secuence.. you can make this logic as your last sequence, this will wait for defined time elapse before going back to initial state again..

 

Hope it helps..

 

Regards

 

HS

 

Time Control.JPG  

Message 4 of 8
(5,674 Views)

What does one need to implement in the final state for the state machine to become idle until the next timed loop cycle? Add a wait that is longer than a loop cycle, add an empty while loop, etc? I am stuck on this question. 

 

(this is an instance of state-machine type of reading digital inputs) After a sequence of reads is done, do nothing until the next reading sequence begins (at a specified sampling rate)).

 

Thanks for the help, Luka

0 Kudos
Message 5 of 8
(5,160 Views)

I've attached a state machine example to show how you can stay at a specific state until an input gives when to move to a different state. 

 

https://decibel.ni.com/content/docs/DOC-22972

 

For your case,  you need to decide how your code "begins" to change from a waiting state to a sampling state. In the example, in the "Intruder?" state the input of the Intruder button chooses between changing between the "Log Intrustion" state or staying in the same "Intruder?" state. For you, it will be advantageous to have a logic statement that yields a true when you want to start sampling data again or a false when you want to stay in the wait for data state.

Ian M.
National Instruments
0 Kudos
Message 6 of 8
(5,120 Views)

Hello

 

I am trying to work on some states machine using the ELVIS II FPGA board. There are 3 states: idle, count up, count down

At count up, I should display 0-99 then move to cound down, showing 99-0. If during count up user press a button on board, it should abort and return to idle.

Maybe bad approach by using a for loop to create the counts, because once into for loop, it wont read any button until after finish. Based on your post, do you have any other approach to this?

0 Kudos
Message 7 of 8
(5,000 Views)

You should probably start a new thread.  This one is several months old and has been marked as solved.

 

The button terminal must be inside the loop tobe read.

 

Lynn

0 Kudos
Message 8 of 8
(4,992 Views)