Preliminary
SN8P1702A/SN8P1703A
8-bit micro-controller build-in 12-bit ADC
TC0C COUNTING REGISTER
TC0C is an 8-bit counter register for the timer counter (TC0). TC0C must be reset whenever the TC0ENB is set “1” to
start the timer counter. TC0C is incremented by one with a clock pulse which the frequency is determined by
TC0RATE0 ~ TC0RATE2. When TC0C has incremented to “0FFH”, it is will be cleared to “00H” in next clock and an
overflow is generated. Under TC0 interrupt service request (TC0IEN) enable condition, the TC0 interrupt request flag
will be set “1” and the system executes the interrupt service routine.
TC0C initial value = xxxx xxxx
0DBH
TC0C
Bit 7
TC0C7
R/W
Bit 6
TC0C6
R/W
Bit 5
TC0C5
R/W
Bit 4
TC0C4
R/W
Bit 3
TC0C3
R/W
Bit 2
TC0C2
R/W
Bit 1
TC0C1
R/W
Bit 0
TC0C0
R/W
TC0 Overflow Time
TC0 rate is determinate by TC0Rate and Code Option TC0_Counter, TC0Rate can set TC0 clock frequency and
TC0_Counter set TC0 became 8-bit, 6-bit, 5-bit or 4-bit counter.
The equation of TC0C initial value is as following.
TC0C initial value = N - (TC0 interrupt interval time * input clock)
Which N is determinate by code option: TC0_Counter
TC0_Counter
8-bit
N
256
64
Max. TC0C value
255
63
6-bit
5-bit
32
31
4-bit
16
15
ꢀ
Note: TheTC0C must small or equal than Max. TC0 value.
ꢁExample: To set 10ms interval time for TC0 interrupt at Fosc = 3.58MHz
TC0C value (74H) = 256 - (10ms * fcpu/64) (TC0RATE=010, TC0_Counter=8-bit, TC0X8=0)
TC0C initial value = 256 - (TC0 interrupt interval time * input clock)
= 256 - (10ms * 3.58 * 106 / 4 / 64)
= 256 - (0.01 * 3.58 * 106 / 4 / 64)
= 116
= 74H
ꢁExample: To set 1.25ms interval time for TC0 interrupt at Fosc = 3.58MHz
TC0C value (74H) = 256 - (10ms * fcpu/64) (TC0RATE=010, TC0_Counter=8-bit, TC0X8=1)
TC0C initial value = 256 - (TC0 interrupt interval time * input clock)
= 256 - (1.25ms * 3.58 * 106 / 32)
= 256 - (0.00125 * 3.58 * 106 / 32)
= 116
= 74H
ꢁExample: To set 1ms interval time for TC0 interrupt at Fosc = 3.58MHz
TC0C value (32H) = 64 - (1ms * fcpu/64) (TC0RATE=010, TC0_COunter=6-bit, TC0X8=0)
TC0C initial value = 64 - (TC0 interrupt interval time * input clock)
= 64 - (1ms * 3.58 * 106 / 4 / 64)
= 64 - (0.001 * 3.58 * 106 / 4 / 64)
= 64 - 14
= 32H
SONiX TECHNOLOGY CO., LTD
Page 57
Revision 0.5