SN8P2711A
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 86
Version 0.1
¾
Example: To set 10ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0, TC0X8=0) and
no PWM output (PWM0=0). High clock is external 4MHz. Fcpu=Fosc/4. Select TC0RATE=010 (Fcpu/64).
TC0C initial value = N - (TC0 interrupt interval time * input clock)
= 256 - (10ms * 4MHz / 4 / 64)
= 256 - (10
-2
* 4 * 10
6
/ 4 / 64)
= 100
= 64H
The basic timer table interval time of TC0, TC0X8 = 0.
High speed mode (Fcpu = 4MHz / 4)
Low speed mode (Fcpu = 32768Hz / 4)
TC0RATE TC0CLOCK
Max overflow interval One step = max/256
Max overflow interval One step = max/256
000
Fcpu/256
65.536 ms
256 us
8000 ms
31250 us
001
Fcpu/128
32.768 ms
128 us
4000 ms
15625 us
010
Fcpu/64
16.384 ms
64 us
2000 ms
7812.5 us
011
Fcpu/32
8.192 ms
32 us
1000 ms
3906.25 us
100
Fcpu/16
4.096 ms
16 us
500 ms
1953.125 us
101
Fcpu/8
2.048 ms
8 us
250 ms
976.563 us
110
Fcpu/4
1.024 ms
4 us
125 ms
488.281 us
111
Fcpu/2
0.512 ms
2 us
62.5 ms
244.141 us
The basic timer table interval time of TC0, TC0X8 = 1.
High speed mode (Fcpu = 4MHz / 4)
Low speed mode (Fcpu = 32768Hz / 4)
TC0RATE TC0CLOCK
Max overflow interval One step = max/256
Max overflow interval One step = max/256
000
Fosc/128
8.192 ms
32 us
1000 ms
7812.5 us
001
Fosc/64
4.096 ms
16 us
500 ms
3906.25 us
010
Fosc/32
2.048 ms
8 us
250 ms
1953.125 us
011
Fosc/16
1.024 ms
4 us
125 ms
976.563 us
100
Fosc/8
0.512 ms
2 us
62.5 ms
488.281 us
101
Fosc/4
0.256 ms
1 us
31.25 ms
244.141 us
110
Fosc/2
0.128 ms
0.5 us
15.625 ms
122.07 us
111
Fosc/1
0.064 ms
0.25 us
7.813 ms
61.035 us