SN8F2250B Series
USB 2.0 Full-Speed 8-Bit Micro-Controller
8.6.4 TC1R AUTO-LOAD REGISTER
TC1 timer is with auto-load function controlled by ALOAD0 bit of TC1M. When TC1C overflow occurring, TC1R value
will load to TC1C by system. It is easy to generate an accurate time, and users don’t reset TC1C during interrupt
service routine.
TC1 is double buffer design. If new TC1R value is set by program, the new value is stored in 1st buffer. Until TC1
overflow occurs, the new value moves to real TC1R buffer. This way can avoid TC1 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.
08DH
TC1R
Read/Write
After reset
Bit 7
TC1R7
W
Bit 6
TC1R6
W
Bit 5
TC1R5
W
Bit 4
TC1R4
W
Bit 3
TC1R3
W
Bit 2
TC1R2
W
Bit 1
TC1R1
W
Bit 0
TC1R0
W
0
0
0
0
0
0
0
0
The equation of TC1R initial value is as following.
TC1R 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.
TC1R valid
value
TC1R value
binary type
TC1CKS PWM0 ALOAD0 TC1OUT
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
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 TC1 interrupt. TC1 clock source is Fcpu (TC1KS=0) and no PWM
output (PWM0=0). High clock is internal 6MHz. Fcpu=Fosc/1. Select TC1RATE=010 (Fcpu/64).
TC1R initial value = N - (TC1 interrupt interval time * input clock)
= 256 - (1ms * 6MHz / 1 / 64)
= 256 - (10-3 * 6 * 106 / 1 / 64)
= 162
= A2H
SONiX TECHNOLOGY CO., LTD
Page 95
Version 1.1