LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why timer anomalies in event structure?

I'm an old hand at LabVIEW, but fairly new at EVENT structures.

I ran into a problem in my program, I thought I diagnosed it, and wrote a simple tester (attached) to test my theory.

The tester has a WHILE loop.
Inside the WHILE loop is an event structure.
One event is the STOP button - it stops the WHILE loop.
Another event is the WAIT button - it waits for 200 mSec and then continues.
Another even is the TIMEOUT - set for 1000 mSec. It calculates the time interval since the previous TIMEOUT event, and displays the latest 10 intervals.

When run, it continuously displays 1000 or 1001 mSec as expected.
When you click the WAIT button, I expected it to show a 1200 mSec interval or thereabouts.

Instead, I see
a 1300, 1500, even 2400 mSec interval!

What the heck causes all that?

If it was the GUI, drawing the button changing states, then I would expect it to be proportionate to the button's screen size. I resized the button, but I don't see any such link.

I'm on Win2000, 1500 MHz P-4. I wouldn't expect it to take 1000 mSec or more just to draw a single button.

What's going on?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 3
(2,883 Views)
Here's my first take on this:

Unlike other events the timeout event will not que up and it will restart it's counting when another event has happened. The time value will be the time it is handled, not the time it went into the que as with other events.

So let's say that there was a timeout at 10:00:00:000.
After 300 ms you press the wait 200 ms button. The event returns at 10:00:00:500. Now the timeout starts running again and after 1000 ms it fires and is handled. Now however it's 10:00:01:500, and you calculate a delta t of 1500 seconds.

This way the maximum delta t can become 2*Timeout+Wait time.

If this is true I have some code that needs adjustment myself to work 100% correct; code that expects the timeout to enter the que and be handled even i
f the event structure was busy when the timeout occured.
Message 2 of 3
(2,883 Views)
< slaps head >
Well, duhhh.. I should have seen that.
If it's 999 mSec into the timeout when the "wait" event occurs, then it will add 200 mSec to the 999, and start another timeout counter at 1199. If that one times out, then I'm sitting at 2199 mSec between events.

Sometimes I can't see the forest for the trees.

Thanks,
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 3
(2,883 Views)