How convert the jitters to a TICK
Hi,
I have a question how to add the jitters to a timer expires. For instance,
//declare a time,
struct timer periodic_timer;
// start a timer in period of two seconds
timer_set( &periodic_timer, configTICK_RATE_HZ * 2 );
// since there are jitters, when timer expired and reset, I need to add these jiffters. below is code.
if( timer_expired( &periodic_timer ) ){
periodic_timer.interval += (( ulMaxJitter * mainNS_PER_CLOCK ) / mainNS_PER_TICK);
timer_reset( &periodic_timer );
….. do something…..
}
// Note: ulMaxJitter is measured by the high freq task.
mainNS_PER_CLOCK is 20ns.
Because configTICK_RATE_HZ is 200, so mainNS_PER_TICK is 5000000ns.
I wonder if above code is correct?
Thanks,
Bill Yang
How convert the jitters to a TICK
Please do not create multiple threads on the same topic.
Regards.