01-15-2012 01:01 PM
Hi folks,
is it possible to have multiple(10/20) timer in a state machine? Timer I meant as a stop watch, every stop watch will be set by queue with state machine and when the timer became 0 it will turn a Boolean on/off also, 20 timer will be on in same time and I have to check periodically all the timer with other command in state machine. Which is easy to use with a parallel while loop but I don't know if its possible to use 20 while loop in parallel in one vi. Is there any hardware timer can I use for this? probably will use cRIO for this.
thanks in advance.
Solved! Go to Solution.
01-15-2012 01:18 PM
I am not completely clear on what you are asking, but I will attempt to address your questions.
Certainly multiple timers are possible. The biggest issue may be what happens if several timers become 0 at the same time. One way to approach this is to use multiple copies of the Express timer VI. Another way would be to have an array of Stop times. Periodically check the current time against the values in the array, setting a boolean for each one where the time has expired. If the timing is too fast for software, it could probably be run on an FPGA system.
Lynn
01-15-2012 01:25 PM
Thanks john for quick response. Can you elaborate little bit more. if i use an express time vi, will it not be stuck in a while loop?
and yes i will build an array of timer to check it. can you send me an simple example ?
01-15-2012 01:54 PM
The Elapsed Time Express VI does not wait until it has timed out. Each time it is called it returns immediately with a boolean indicating whether the time has elapsed along with a numeric indiating how much time has elapsed. It also has several reset options for starting it again.
Look at the detailed help and make some simple test VIs to see what it does. The attached VI has the timer set for 10 seconds.
Lynn
01-15-2012 02:10 PM
This is very easy with LVOOP. Here is a timer class that I wrote some time ago (no pun intended) and an example of how to use it.