SN8P1700
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 114
Revision 1.93
T0C COUNTING REGISTER
T0C is an 8-bit counter register for the basic timer (T0). T0C must be reset whenever the T0ENB is set “1” to start the
basic timer. T0C is incremented by one with every clock pulse which frequency is determined by T0RATE0 ~
T0RATE2. When T0C has incremented to “0FFH”, it will be cleared to “00H” in next clock and an overflow generated.
Under T0 interrupt service request (T0IEN) enable condition, the T0 interrupt request flag will be set “1” and the system
executes the interrupt service routine. The T0C has no auto reload function. After T0C overflow, the T0C is continuing
counting. Users need to reset T0C value to get a accurate time.
T0C initial value = xxxx xxxx
0D9H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
T0C
T0C7 T0C6 T0C5 T0C4 T0C3 T0C2 T0C1 T0C0
R/W R/W R/W R/W R/W R/W R/W R/W
High speed mode (fcpu = 3.58MHz / 4)
Low speed mode (fcpu = 32768Hz / 4)
T0RATE T0CLOCK
Max overflow interval
One step = max/256
Max overflow interval
One step = max/256
000
fcpu/256
73.2 ms
286us
8000 ms
31.25 ms
001
fcpu/128
36.6 ms
143us
4000 ms
15.63 ms
010
fcpu/64
18.3 ms
71.5us
2000 ms
7.8 ms
011
fcpu/32
9.15 ms
35.8us
1000 ms
3.9 ms
100
fcpu/16
4.57 ms
17.9us
500 ms
1.95 ms
101
fcpu/8
2.28 ms
8.94us
250 ms
0.98 ms
110
fcpu/4
1.14 ms
4.47us
125 ms
0.49 ms
111
fcpu/2
0.57 ms
2.23us
62.5 ms
0.24 ms
Figure 7-3. The Timing Table of Basic Timer T0.
The equation of T0C initial value is as following.
T0C initial value = 256 - (T0 interrupt interval time * input clock)
Example : To set 10ms interval time for T0 interrupt at 3.58MHz high-speed mode. T0C value (74H) = 256 -
(10ms * fcpu/64)
T0C initial value = 256 - (T0 interrupt interval time * input clock)
= 256 - (10ms * 3.58 * 10
6
/ 4 / 64)
= 256 - (10
-2
* 3.58 * 10
6
/ 4 / 64)
= 116
= 74H