??? 07/26/05 12:15 Read: times |
#98136 - This is a nice little bug that show up Responding to: ???'s previous message |
Oh Jan, I hoped you would not continue, I were going to use it for next weeks puzzle.
This is a nice little bug that show up once in 4711 hours. I take one case in your example A way is to chose the reload value so that it is an integer multiple of 256 Then it is simply enough to reload THx at the beginning of timer isr, where the already elapsed ticks since overflow don't cause THx to be already incremented. let us use T1 for this (clcocking by instruction cycle (/12)) let us say we have a IE0 interrupt that process in 188 instruction cycles let us say we have an IE1 interrupt that process in 99 instruction cycles now, after succesfully running for 4711 hours these 3 interrupts concur and BOOM. OK, this can be avoided by priority; however this is a classic exampe of a trap for future modifications. Erik This is a nice example of why "qualification by testing" is a crock. |