LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

AsyncTimer interval

Hi,

I'm using AsyncTimer to create thread which read data from RS-232.
Working fine until increasing interval over 65 sec. In Win98 when I set
interval to 66 sec interval will be 1 sec, 67 sec -> 2 sec and so on.
Win2000 works OK.

If I have understand right, AsyncTimer uses window multimedia timer.
Multimedia timers parameter Delay is UINT indicating milliseconds. So
maximum interval is about 65,5 sec. Why it is more in Win2000?

Any succestion how to get longer intervals in Win98?

Thanks,
Kari Yli-Tuomi
0 Kudos
Message 1 of 2
(3,053 Views)
I would workaround the problem by setting the interval to a smaller value and only executing your timer callback code for every N calls. For example, if you want a callback of 35 seconds. Set the callback for 35 seconds and N to 1. If you want 70 seconds, set the callback for 35 seconds and N to 2. Then just use N and an incrementer to determin if the callback should execute your code. Something like:

#define NUM 2

int iTimerCalls = 0;

int CVICALLBACK MyTimerCallback (int reserved, int theTimerId, int event, void *callbackData, int eventData1, int eventData2)
{
iTimerCalls++;
if(iTimerCalls==NUM)
{
iTimerCalls=0;
/*Your timer code here*/
}

}

I don't know why W2K is different, but this would workaround the problem for all OS's.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 2
(3,053 Views)