Forum Discussion
Altera_Forum
Honored Contributor
14 years agoTimers 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.