[En-Nut-Discussion] timer handling / missing ticks

Matthias Ringwald mringwal at inf.ethz.ch
Fri Jul 15 18:11:30 CEST 2005


Hi Harald, and others.

I was just wondering why a simple app like
  while (1) {
    printf("Time: %ld s\n," NutGetSeconds();
    NutSleep(5000);
  }
was a) giving the correct time, but b) did this roughly every 8  
seconds. ???

The reason for this is that while changing timers, processing elapsed  
ones, we stop the countdown in
the TimerIrq. While trying to count missing ticks and later apply the  
diff in NutTimerProcessElapsed,
I wonder why not just do the complete timer handling there and only  
keep two counters in NutTimerIrq,
the current one, and one that counts the ticks since the last  
NutTimerProcessElapsed?
Then in NutTimerProcessElapsed we figure out, which timeouts did  
happen and process them.

Any drawbacks to this?

Cheers,
Matthias



More information about the En-Nut-Discussion mailing list