RE: [bascom] 8051: Crystal accuracy problem or Timer & Interrupts mistake?
Hello Patrick,
Your first program (reload mode) should be good.
Even when other isr code is being executed and the Timer0 isr is not
serviced at once it works fine as long as the other isr doesn't consume too
much time.
Otherwise you mightmiss a 250 uSec. update.
The second program can become too slow if the isr is not serviced at once.
You should also take into account that you will miss some ticks between the
interrupt and the time the counter is started again : a lcall to the isr,
the "Counter0 = 40536" and the "Start Timer0" statements.
This could be compensated by adjusting the value 40536 (like 40540 ?).
Eric Le Baron
Wageningen
The Netherlands