SN8P2624
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 78
Version 0.3
8.3.3 TC1C COUNTING REGISTER
TC1C is an 8-bit counter register for TC1 interval time control.
0DDH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TC1C
TC1C7 TC1C6 TC1C5 TC1C4 TC1C3 TC1C2 TC1C1 TC1C0
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 TC1C initial value is as following.
TC1C initial value = N - (TC1 interrupt interval time * input clock)
N is TC1 overflow boundary number. TC1 timer overflow time has six types (TC1 timer, TC1 event counter, TC1 Fcpu
clock source, TC1 Fosc clock source, PWM mode and no PWM mode). These parameters decide TC1 overflow time
and valid value as follow table.
TC1CKS PWM1 ALOAD1 TC1OUT
N
TC1C valid
value
TC1C value
binary type
Remark
0
x
x
256
0x00~0xFF
00000000b~11111111b
Overflow per 256 count
1
0
0
256
0x00~0xFF
00000000b~11111111b
Overflow per 256 count
1
0
1
64
0x00~0x3F
xx000000b~xx111111b
Overflow per 64 count
1
1
0
32
0x00~0x1F
xxx00000b~xxx11111b
Overflow per 32 count
0
1
1
1
16
0x00~0x0F
xxxx0000b~xxxx1111b
Overflow per 16 count
1
-
-
-
256
0x00~0xFF
00000000b~11111111b
Overflow per 256 count
¾
Example: To set 10ms interval time for TC1 interrupt. TC1 clock source is Fcpu (TC1KS=0) and no PWM
output (PWM1=0). High clock is external 4MHz. Fcpu=Fosc/4. Select TC1RATE=010 (Fcpu/64).
TC1C initial value = N - (TC1 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 TC1.
High speed mode (Fcpu = 4MHz / 4)
Low speed mode (Fcpu = 32768Hz / 4)
TC1RATE TC1CLOCK
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