English
Language : 

SN8P2602B Datasheet, PDF (78/95 Pages) SONiX Technology Company – 8-Bit Micro-Controller
SN8P2602B
8-Bit Micro-Controller
8.3.4 TC0R AUTO-LOAD REGISTER
TC0 timer is with auto-load function controlled by ALOAD0 bit of TC0M. When TC0C overflow occurring, TC0R value
will load to TC0C by system. It is easy to generate an accurate time, and users don’t reset TC0C during interrupt
service routine.
TC0 is double buffer design. If new TC0R value is set by program, the new value is stored in 1st buffer. Until TC0
overflow occurs, the new value moves to real TC0R buffer. This way can avoid TC0 interval time error and glitch in
PWM and Buzzer output.
’ Note: Under PWM mode, auto-load is enabled automatically. The ALOAD0 bit is selecting overflow
boundary.
0CDH
TC0R
Read/Write
After reset
Bit 7
TC0R7
W
0
Bit 6
TC0R6
W
0
Bit 5
TC0R5
W
0
Bit 4
TC0R4
W
0
Bit 3
TC0R3
W
0
Bit 2
TC0R2
W
0
Bit 1
TC0R1
W
0
Bit 0
TC0R0
W
0
The equation of TC0R initial value is as following.
TC0R 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.
TC0CKS PWM0 ALOAD0 TC0OUT
N
TC0R valid
value
TC0R value
binary type
0
x
x
256 0x00~0xFF 00000000b~11111111b
1
0
0
256 0x00~0xFF 00000000b~11111111b
0
1
0
1
64 0x00~0x3F xx000000b~xx111111b
1
1
0
32 0x00~0x1F xxx00000b~xxx11111b
1
1
1
16
0x00~0x0F xxxx0000b~xxxx1111b
1
-
-
-
256 0x00~0xFF 00000000b~11111111b
¾ Example: To set 10ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0) and no PWM
output (PWM0=0). High clock is external 4MHz. Fcpu=Fosc/4. Select TC0RATE=010 (Fcpu/64).
TC0R initial value = N - (TC0 interrupt interval time * input clock)
= 256 - (10ms * 4MHz / 4 / 64)
= 256 - (10-2 * 4 * 106 / 4 / 64)
= 100
= 64H
SONiX TECHNOLOGY CO., LTD
Page 78
Preliminary Version 0.4