2camjohn Member Oct 27, 2004 #1 I am trying to set up the timer for a PIC16f629 I think I am missing something in my calculation. I am running at 4mhz, so each cycle takes 0.00000025 seconds The prescalar is at 255 (111) so that means there is an interrupt every 0.000064 seconds. Does that seem right to you? Because it seems slightly small to me? Anyone have any tips on using the timers? Thanks John
I am trying to set up the timer for a PIC16f629 I think I am missing something in my calculation. I am running at 4mhz, so each cycle takes 0.00000025 seconds The prescalar is at 255 (111) so that means there is an interrupt every 0.000064 seconds. Does that seem right to you? Because it seems slightly small to me? Anyone have any tips on using the timers? Thanks John
Exo Active Member Oct 27, 2004 #2 The timers run on Fosc/4. so with a 4Mhz crystal they only get 1000 000 counts / sec. And every time the prescaler rolls over, the timer register gets one tick. Once the timer register rolls over you get an interrupt.
The timers run on Fosc/4. so with a 4Mhz crystal they only get 1000 000 counts / sec. And every time the prescaler rolls over, the timer register gets one tick. Once the timer register rolls over you get an interrupt.
2camjohn Member Oct 27, 2004 #3 OK so... I am running at 4mhz, so each cycle takes 0.00000025 seconds A timer running on FOSC/4 will count every 0.000001 seconds The timer increments after 256 counts which is every 0.000256 seconds. And we get an interrupt when the timer overflows its 8 bits (another 256) which is every 0.065536 seconds. That seems better to me. Is it correct? Thanks John
OK so... I am running at 4mhz, so each cycle takes 0.00000025 seconds A timer running on FOSC/4 will count every 0.000001 seconds The timer increments after 256 counts which is every 0.000256 seconds. And we get an interrupt when the timer overflows its 8 bits (another 256) which is every 0.065536 seconds. That seems better to me. Is it correct? Thanks John