if i have a 8mhz osc, and a 1/8 prescaler, then i start and stop my timer1, what is the units of the timervalue? i want to be able to measure time between start and stop in microseconds.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use this for timer0 with no prescaler, tick_interval defined in ns
#define TICK_Clk TICK_INTERVAL*ChipMHz/4000
If you use this formula and add /8 for the prescaler value 8, then the result is 250 clk.
subsequently one ms equivales to a timer value of 250
With a error of 2.4% you could simply use the high byte of timer1 in order to read ms (max 256) directly.
It´s possible to calibrate the chip in such a way that the internal resonator is off 2.4% in order to compensate the
error on some chips. Hope this helps
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
for microseconds , you should change the prescaler to 2 and you can read directly microseconds, otherwise you must multiply(shift) the result by 4(2) .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if i have a 8mhz osc, and a 1/8 prescaler, then i start and stop my timer1, what is the units of the timervalue? i want to be able to measure time between start and stop in microseconds.
May be you will clarify the TIMERx useage with this free tool:
http://pictimer.picbingo.com/
It looks nice, I did not use it yer.
Let us know your experience please.
I use this for timer0 with no prescaler, tick_interval defined in ns
#define TICK_Clk TICK_INTERVAL*ChipMHz/4000
If you use this formula and add /8 for the prescaler value 8, then the result is 250 clk.
subsequently one ms equivales to a timer value of 250
With a error of 2.4% you could simply use the high byte of timer1 in order to read ms (max 256) directly.
It´s possible to calibrate the chip in such a way that the internal resonator is off 2.4% in order to compensate the
error on some chips. Hope this helps
for microseconds , you should change the prescaler to 2 and you can read directly microseconds, otherwise you must multiply(shift) the result by 4(2) .