04-07-2015 12:16 PM - edited 04-07-2015 12:16 PM
I've download an example VI demonstratinig how to use the function of occurrence.
When I tested that VI, it is "sometimes" not triggered in all wait on occurrence.
I have no idea how to explain it...
Cound anyone give me some suggestion?
Thanks a lot!
Solved! Go to Solution.
04-07-2015 12:38 PM
What exactly is your question? Are you asking why sometimes a timeout condition occurs? You are triggering the occurrence every 100ms, and you have a 100ms timeout on the Wait on Occurrence. The timing isn't that precise. The Wait (ms) function sets a lower bound on the wait but does not dictate absolute timing, so that loop will often take slightly longer than 100ms. On a desktop operating system (such as Windows) there is no way to guarantee absolute timing - you need a real-time operating system for that. Since the occurrence will sometimes not be set within 100ms, the Wait on Occurrence will occasionally time out. Use a longer timeout on the Wait on Occurrence and you'll see this much less frequently, with little effect on the overall system timing.
04-07-2015 12:47 PM
Also try setting "ignore previous" to FALSE (default is TRUE).
04-08-2015 12:14 PM - edited 04-08-2015 12:16 PM
Very thanks nathand and altenbach's suggestioins, it helps a lot.
I agree that the jitter has influence on it.
I'd like to figure out more detailed thinking, like the following image as the last attached image
It is "often" both Couter and Timeout increased by 1 in one loop than the other.
How to realize it?
After thinking after your suggestions, there're two images in my brain,
(I like to upload image to express my thoughts, since it show my thinking clearly,
and hope you may not be confused with my poor English expression)
While the jitter happened, say timeout of LOOP 2 exceeds the LOOP 1, and a trigger just goes between the timing,
and then LOOP 1 get one more timeout, and the "Counters" remain the same.
There's a increment function after the wait on occurrence, say "math".
If LOOP 2 is doing the math, and the trigger just happened, and then LOOP 2 miss a counter.
Is my above thoughts correct? Is there other possible situation?
I still can not figure out how does the "Timeout" and "Counter" usually increment or decrement together.
Hope I don't go too far away to the discussion...
04-08-2015 12:27 PM
William1225 wrote:
I still can not figure out how does the "Timeout" and "Counter" usually increment or decrement together.
Let's say the loop that sets the occurrence takes just slightly longer than 100ms. This causes the timeout to increment. Then, on the next cycle of the timeout/counter loop, the occurrence is set immediately (because the loop that set it took just barely longer than the timeout time), so the counter increments immediately. This is exactly what you'd expect.
04-08-2015 12:40 PM
04-08-2015 12:50 PM
@William1225 wrote:
The situation shown in LOOP 1 in this image never happens! You won't ever have the same "Wait On Occurrence" waiting for the occurrence twice in the same loop cycle. Your drawing should show that as soon as the occurrence happens the first time, it goes on to the next loop cycle.
04-10-2015 12:26 PM
I should say sorry to nathand & altenbach...
It's my misunderstanding to the code, mistake the "Timeout" doing the same action(increment while timeout) as the "Counter", the Timeout is just the index of the while loop...
No wonder you are not surprised at the increment of both Counter and Timeout.
So stupid I am, but I still make something clear. Thanks nathand and altenback's suggestions again!