- Wed Dec 23, 2009 4:10 pm
#87805
i've setup a timer on an atmega168 in CTC mode since I want an interrupt generated every 1e-4 sec. if my clock is @ 8mhz and i prescale by 8 so it counts every 1e-6 sec, so if i set output compare register to 99 (not 100, right?) it will generate an interrupt every 1e-4 sec?
second question... i'm running a short code inside the interrupt call and before i actually start running it, i stop the counter (by clearing all prescaler select bits) and reset TCNT1 to 0. is this really needed? do i need to stop it at all? and what about resetting the TCNT1 value?
thanks!
second question... i'm running a short code inside the interrupt call and before i actually start running it, i stop the counter (by clearing all prescaler select bits) and reset TCNT1 to 0. is this really needed? do i need to stop it at all? and what about resetting the TCNT1 value?
thanks!