Delay and interrupt in example
Posted: Sun Feb 24, 2008 2:42 am
Hi,
I have just downloaded the TMR0-Int-1sec example and have found something odd in it,
Now the way I understand it is the interrupt occurs and a counter is incremented,
every 38 interrupts X is incremented. regardless of what main is doing, since its an interrupt.
The main loop just outputs X value.
Question is why does it not work properly if the 10ms delay is removed, or increased to say 5 seconds.
if the delay is 5 seconds shouldn't it just update portb every 5 seconds and X continue to increment every second?
I have just downloaded the TMR0-Int-1sec example and have found something odd in it,
Now the way I understand it is the interrupt occurs and a counter is incremented,
every 38 interrupts X is incremented. regardless of what main is doing, since its an interrupt.
The main loop just outputs X value.
Question is why does it not work properly if the 10ms delay is removed, or increased to say 5 seconds.
if the delay is 5 seconds shouldn't it just update portb every 5 seconds and X continue to increment every second?