Hi,
I have problem with GlobalMonoTimers, maybe i't my mistake... We use some complicated timers usage, so we need about 30 timers at same time and there is some strange...
I write some example:
#define E_RDR2_PING_TIMEOUT 21
#define E_RDR2_DO_PING 23
#define E_RDR_3SEC 24
void fnApplication(TTASKTABLE *ptrTaskTable)
{
....
if (!iAppState) {
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(5*SEC), E_RDR2_DO_PING);
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(1*SEC), E_RDR2_PING_TIMEOUT);
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(0.5*SEC), E_RDR_3SEC);
iAppState = 1;
} // END OF INIT
// check input queue
while ( fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH )) {
// switch depending on message source
switch ( ucInputMessage[ MSG_SOURCE_TASK ] ) {
case TIMER_EVENT:
if (E_RDR2_DO_PING == ucInputMessage[ MSG_TIMER_EVENT ]) {
fnDebugMsg("RDR2 do ping\r\n");
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(5*SEC), E_RDR2_DO_PING);
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(1*SEC), E_RDR2_PING_TIMEOUT);
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(0.5*SEC), E_RDR_3SEC);
}
else if (E_RDR2_PING_TIMEOUT == ucInputMessage[ MSG_TIMER_EVENT ]) {
fnDebugMsg("Ping timeout\r\n");
LED_2_OFF();
}
else if (E_RDR_3SEC == ucInputMessage[ MSG_TIMER_EVENT ]) {
fnDebugMsg("3SEC timeout\r\n");
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(5*SEC), E_RDR2_DO_PING);
uTaskerGlobalStopTimer( OWN_TASK, E_RDR2_PING_TIMEOUT );
}
break;
default:
// flush any unexpected messages (assuming they arrived from another task)
fnRead( PortIDInternal, ucInputMessage, ucInputMessage[MSG_CONTENT_LENGTH]);
break;
}
}
}
Right behaviour:
After uTasker boot set up three timers: E_RDR2_DO_PING, E_RDR2_PING_TIMEOUT, E_RDR_3SEC. After 0.5 sec, the first timer E_RDR_3SEC may elapse. So timer E_RDR2_DO_PING shoud be relaunch to 5 sec interval, and timer E_RDR2_PING_TIMEOUT should be stopped.
Real behaviour:
After 0.5 sec, the first timer E_RDR_3SEC elapsed. After approx next 0.5 timer E_RDR2_DO_PING elapsed. I can't find reason why!?
When I replace code:
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(5*SEC), E_RDR2_DO_PING);
uTaskerGlobalStopTimer( OWN_TASK, E_RDR2_PING_TIMEOUT );
with
uTaskerGlobalStopTimer( OWN_TASK, E_RDR2_DO_PING);
uTaskerGlobalStopTimer( OWN_TASK, E_RDR2_PING_TIMEOUT );
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(5*SEC), E_RDR2_DO_PING);
everithing works fine....
As I mentioned before we use many timers at same time and this undefined/undocumented behaviour is very bad for us... Please help...
Thanks...
Best Regards...