SN8F2250B Series
USB 2.0 Full-Speed 8-Bit Micro-Controller
8.4.3 TC0C COUNTING REGISTER
TC0C is an 8-bit counter register for TC0 interval time control.
089H
TC0C
Read/Write
After reset
Bit 7
TC0C7
R/W
0
Bit 6
TC0C6
R/W
0
Bit 5
TC0C5
R/W
0
Bit 4
TC0C4
R/W
0
Bit 3
TC0C3
R/W
0
Bit 2
TC0C2
R/W
0
Bit 1
TC0C1
R/W
0
Bit 0
TC0C0
R/W
0
The equation of TC0C initial value is as following.
TC0C initial value = N - (TC0 interrupt interval time * input clock)
N is TC0 overflow boundary number. TC0 timer overflow time has six types (TC0 timer, TC0 event counter, TC0 Fcpu
clock source, TC0 Fosc clock source, PWM mode and no PWM mode). These parameters decide TC0 overflow time
and valid value as follow table.
TC0C valid
value
TC0C value
binary type
TC0CKS PWM0 ALOAD0 TC0OUT
Remark
N
0
1
1
1
1
-
x
0
0
1
1
-
x
0
1
0
1
-
256
256
64
32
16
0x00~0xFF 00000000b~11111111b
0x00~0xFF 00000000b~11111111b
Overflow per 256 count
Overflow per 256 count
Overflow per 64 count
Overflow per 32 count
Overflow per 16 count
Overflow per 256 count
0
1
0x00~0x3F
0x00~0x1F
0x00~0x0F
xx000000b~xx111111b
xxx00000b~xxx11111b
xxxx0000b~xxxx1111b
256
0x00~0xFF 00000000b~11111111b
¾
Example: To set 1ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0) and no PWM
output (PWM0=0). High clock is internal 6MHz. Fcpu=Fosc/1. Select TC0RATE=010 (Fcpu/64).
TC0C initial value = N - (TC0 interrupt interval time * input clock)
= 256 - (1ms * 6MHz / 1 / 64)
= 256 - (10-3 * 6 * 106 / 1 / 64)
= 162
= A2H
The basic timer table interval time of TC0.
High speed mode (Fcpu = 6MHz / 1)
TC0RATE TC0CLOCK
Max overflow interval One step = max/256
000
001
010
011
100
101
110
111
Fcpu/256
Fcpu/128
Fcpu/64
Fcpu/32
Fcpu/16
Fcpu/8
10.923 ms
5.461 ms
2.731 ms
1.365 ms
0.683 ms
0.341 ms
0.171 ms
0.085 ms
42.67 us
21.33 us
10.67 us
5.33 us
2.67 us
1.33 us
0.67 us
0.33 us
Fcpu/4
Fcpu/2
SONiX TECHNOLOGY CO., LTD
Page 84
Version 1.1