SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 78
Version 1.7
8.3.4
TC0C COUNTING REGISTER
TC0C is an 8-bit counter register for TC0 interval time control.
0DBH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TC0C
TC0C7
TC0C6
TC0C5
TC0C4
TC0C3
TC0C2
TC0C1
TC0C0
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
After reset
0
0
0
0
0
0
0
0
The equation of TC0C initial value is as following.
TC0C initial value = 256 - (TC0 interrupt interval time * input clock)
TC0X8
TC0C valid
value
TC0C value
binary type
Remark
0
(Fcpu/2~
Fcpu/256)
0x00~0xFF
00000000b~11111111b
Overflow per 256 count
1
(Fosc/1~
Fosc/128)
0x00~0xFF
00000000b~11111111b
Overflow per 256 count
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 8MHz. Fcpu=Fosc/8. Select TC0RATE=010 (Fcpu/64).
TC0C initial value = N - (TC0 interrupt interval time * input clock)
= 256 - (10ms * 8MHz / 8 / 64)
= 256 - (10
-2
* 8 * 10
6
/ 8 / 64)
= 100
= 64H
The basic timer table interval time of TC0, TC0X8 = 0.
TC0RATE TC0CLOCK
High speed mode (Fcpu = 8MHz / 8)
Low speed mode (Fcpu = 32768Hz / 4)
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.
TC0RATE TC0CLOCK
High speed mode (Fcpu = 8MHz / 8)
Low speed mode (Fcpu = 32768Hz / 4)
Max overflow interval One step = max/256
Max overflow interval
One step = max/256
000
Fosc/128
4.096 ms
16 us
1000 ms
3906.25 us
001
Fosc/64
2.048 ms
8 us
500 ms
1953.125 us
010
Fosc/32
1.024 ms
4 us
250 ms
976.563 us
011
Fosc/16
0.512 ms
2 us
125 ms
488.281 us