LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state space time out

hi all,

 

I wanted to actually ask what is a good way for implementing a software timeout with in a state. Normally I use tick count for measuring the elaspsed time and once 5 or 10 seconds have been passed then time out condition occurs and state changes. As in the sample VI i am attaching. Now I know this is a crude form of time out so I was wondering what is actually a good programming practice to do such a task. Keep in mind I am not talking about event structure or some visa comunication (as i know they handle time out them self) ....purely software based .

 

p.s its not home work . simply just something I am wondering over.

 

Best Regards

Regards
Download All
0 Kudos
Message 1 of 2
(2,251 Views)

I usually just use the Elapsed Time express VI.  I have taken it and made my own version to use, but the concept is the same.  But it does really depend on what you are doing.  Most times, you have the option for the user to abort.  So you will want to bounce between a Check Time and Wait For Event states.  The Wait For Event state will have a timeout of its own (something like 100ms usually works well).  Instead of using the Tick Count, use the timestamp instead.  It will give you a larger range to work with and you won't have to worry about the overflow.  It is also easier to debug since you can see the actual time that it starts the current time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 2
(2,234 Views)