06-16-2014 08:50 AM
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
06-16-2014 10:08 AM
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.