Forum Discussion
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- Timers should normally use 'modulo' arithmetic - where you always subtract the two values that contain 'times' and then look at the value of the difference. So if the current time is 'ms_ticks' use:
if ((int)(ms_ticks - lwip250mStimer) >= 0) {
/* timer has expired */
lwip250mStimer += 250;
}Rather than checking for ms_ticks >= lwip250mStimer. --- Quote End --- No, that doesn't work. It doesn't keep lwip250mStimer a multiple of 250 which the tests in the timer code require. Bill