2 Calculation
Given the frequency of the watch crystal, the user can determine the time for each Timer/Counter tick, by selecting the desired pre-scaling factor. As shown in the following table, CS02, CS01, and CS00 in the TCCR0 (Timer/Counter0 Control Register) define the Timer/Counter prescaler source. In the table, clkT0S denotes the frequency of the Timer/Counter0 clock source. For example, if clkT0S equals 32.768kHz, as in our case, the Timer/Counter will tick at a frequency of 256Hz with a prescaler of 128.
CS02 | CS01 | CS00 | Description (1) | Overflow period |
---|---|---|---|---|
0 | 0 | 0 | Timer/Counter0 is stopped | – |
0 | 0 | 1 | clkT0S | 1/128s |
0 | 1 | 0 | clkT0S/8 | 1/16s |
0 | 1 | 1 | clkT0S/32 | 1/4s |
1 | 0 | 0 | clkT0S/64 | 1/2s |
1 | 0 | 1 | clkT0S/128 | 1s |
1 | 1 | 0 | clkT0S/256 | 2s |
1 | 1 | 1 | clkT0S/1024 | 8s |
Note:
- clkTOS = 32.768kHz.