SN8P2604
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 80
Version 1.1
8.3.4 TC1R AUTO-LOAD REGISTER
TC1 timer is with auto-load function controlled by ALOAD1 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.
0DEH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TC1R
TC1R7 TC1R6 TC1R5 TC1R4 TC1R3 TC1R2 TC1R1 TC1R0
Read/Write
W W W W W W W W
After
reset
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 five types (TC1 timer, TC1 event counter, TC1 Fcpu
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
TC1R valid
value
TC1R value
binary type
0 x x 256
0x00~0xFF
00000000b~11111111b
1 0 0 256
0x00~0xFF
00000000b~11111111b
1 0 1 64
0x00~0x3F
xx000000b~xx111111b
1 1 0 32
0x00~0x1F
xxx00000b~xxx11111b
0
1 1 1 16
0x00~0x0F
xxxx0000b~xxxx1111b
1 - - - 256
0x00~0xFF
00000000b~11111111b
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).
TC1R initial value = N - (TC1 interrupt interval time * input clock)
= 256 - (10ms * 4MHz / 4 / 64)
= 256 - (10
-2
* 4 * 10
6
/ 4 / 64)
= 100
= 64H