SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 80
Version 1.7
8.3.5
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.
3.
Note: Under PWM mode, auto-load is enabled automatically. The ALOAD0 bit is selecting overflow
boundary.
0CDH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TC0R
TC0R7
TC0R6
TC0R5
TC0R4
TC0R3
TC0R2
TC0R1
TC0R0
Read/Write
W
W
W
W
W
W
W
W
After reset
0
0
0
0
0
0
0
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.
TC0X8
TC0R valid
value
TC0R value
binary type
0
(Fcpu/2~Fcpu/256)
0x00~0xFF
00000000b~11111111b
1
(Fosc/1~Fosc/128)
0x00~0xFF
00000000b~11111111b
Example: To set 10ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0, TC0X8=0) and
no PWM output (PWM0=0). High clock is external 8MHz. Fcpu=Fosc/8. Select TC0RATE=010 (Fcpu/64).
TC0R initial value = N - (TC0 interrupt interval time * input clock)
= 256 - (10ms * 8MHz / 8 / 64)
= 256 - (10
-2
* 8 * 10
6
/ 8 / 64)
= 100
= 64H