LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it necessary to call ProcessSystemEvents() after enabling/disabling a timer using SetCtrlAttribute()?

I have a timer that simply stops running.  I am disabling the timer at the beginning of the callback and enabling the timer at the end.  I don't believe anything in the meat of the callback is hanging things up (e.g. infinite loops).  For some odd reason the timer stop running.  Is it possible for the timer to remain in the disabled state and not be enabled for some reason?  I have LabWindows CVI 7.0 running on an older PC, P3 500MHz.  TIA!
0 Kudos
Message 1 of 8
(3,821 Views)

Hi,

If you are disabling the timer at the beginning of a Callback then the will need to allow the Timer Events to be processed and this will not happen until you return from your Callback. therefore you will need to Call ProcessSystemEvents().

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 8
(3,813 Views)
I am not sure if I understand what you are doing correctly.  Do you disable the timer in the callback of the timer itself (Timer tick event) or is it being disabled in the callback for another control?

Message Edited by mvr on 10-14-2006 08:33 AM

0 Kudos
Message 3 of 8
(3,813 Views)

Hello,

I am disabling the timer within the callback of the timer itself during a timer tick event.  It is possible for the duration of the callback function to exceed the timer interval length.  I do not want the timer running during its own callback to prevent multiple calls to the callback. 

Thank you all for your help.

Neil

Message Edited by grendel on 10-16-2006 10:25 AM

0 Kudos
Message 4 of 8
(3,784 Views)
Neil,

So I assume that the symptom you are seeing is that after you reenable the timer, and you exit the callback, the callback is not be called again? If that is the case, then it is indeed unexpected behavior, and I can't explain it.

But what I can say is that based on the reason you gave for disabling the timer, you shouldn't have to do so. UI timers are not reentrant. That is, timer callbacks will not be called from inside a timer callbak, in a nested matter. Instead, the callback will simply be called "late", once the first callback finishes executing.

Luis
0 Kudos
Message 5 of 8
(3,767 Views)
Hi Neil,

I've been trying to replicate your issue at my own system and have so far been unsuccessful. Could you post a small example that replicates the problem you are seeing?
Thanks Neil, have a good one.
Dan Weiland
0 Kudos
Message 6 of 8
(3,764 Views)
Thank you Luis.  The fact the UI timers are not reentrant should simplify things for me.  I will remove the code that disables/enables the timer and use the ResetTimer to ensure the callback occurs at the correct interval.
 
Thanks again,
Neil
0 Kudos
Message 7 of 8
(3,738 Views)

Hello Dan,

Thank you for trying to duplicate the problem.  Unfortunately it is very intermittent (maybe once per 16 hrs).  I will try removing the disabling/enabling of the timers altogether and see how that works.

Thanks,

Neil

0 Kudos
Message 8 of 8
(3,737 Views)