SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
T0 clock source is Fcpu (instruction cycle) through T0rate[2:0] pre-scaler to decide Fcpu/2~Fcpu/256. T0 length is 8-bit
(256 steps), and the one count period is each cycle of input clock.
T0 Interval Time
Fhosc=16MHz,
Fcpu=Fhosc/4
Fhosc=16MHz,
Fcpu=Fhosc/16
T0rate[2:0] T0 Clock
max. (ms) Unit (us) max. (ms) Unit (us)
000b
001b
010b
011b
100b
101b
110b
111b
Fcpu/256
Fcpu/128
Fcpu/64
Fcpu/32
Fcpu/16
Fcpu/8
16.384
8.192
4.096
2.048
1.024
0.512
0.256
0.128
64
32
16
8
4
2
65.536
32.768
16.384
8.192
4.096
2.048
1.024
0.512
256
128
64
32
16
8
Fcpu/4
Fcpu/2
1
0.5
4
2
8.2.3 T0M MODE REGISTER
T0M is T0 timer mode control register to configure T0 operating mode including T0 pre-scaler, clock source…These
configurations must be setup completely before enabling T0 timer.
0D8H
T0M
Read/Write
After reset
Bit 7
T0ENB
R/W
0
Bit 6
T0rate2
R/W
Bit 5
T0rate1
R/W
Bit 4
T0rate0
R/W
Bit 3
Bit 2
Bit 1
Bit 0
-
-
-
-
-
-
-
-
-
-
-
-
0
0
0
Bit [6:4] T0RATE[2:0]: T0 timer clock source select bits.
000 = Fcpu/256, 001 = Fcpu/128, 010 = Fcpu/64, 011 = Fcpu/32, 100 = Fcpu/16, 101 = Fcpu/8, 110 =
Fcpu/4,111 = Fcpu/2.
Bit 7
T0ENB: T0 counter control bit.
0 = Disable T0 timer.
1 = Enable T0 timer.
8.2.4 T0C COUNTING REGISTER
T0C is T0 8-bit counter. When T0C overflow occurs, the T0IRQ flag is set as “1” and cleared by program. The T0C
decides T0 interval time through below equation to calculate a correct value. It is necessary to write the correct value to
T0C register, and then enable T0 timer to make sure the fist cycle correct. After one T0 overflow occurs, the T0C
register is loaded a correct value by program.
0D9H
T0C
Read/Write
After reset
Bit 7
T0C7
R/W
0
Bit 6
T0C6
R/W
0
Bit 5
T0C5
R/W
0
Bit 4
T0C4
R/W
0
Bit 3
T0C3
R/W
0
Bit 2
T0C2
R/W
0
Bit 1
T0C1
R/W
0
Bit 0
T0C0
R/W
0
The equation of T0C initial value is as following.
T0C initial value = 256 - (T0 interrupt interval time * T0 clock rate)
Example: To calculation T0C to obtain 10ms T0 interval time. T0 clock source is Fcpu = 16MHz/16 = 1MHz.
Select T0RATE=001 (Fcpu/128).
T0 interval time = 10ms. T0 clock rate = 16MHz/16/128
T0C initial value = 256 - (T0 interval time * input clock)
= 256 - (10ms * 16MHz / 16 / 128)
-2
= 256 - (10 * 16MHz / 16 / 128)
= B2H
SONiX TECHNOLOGY CO., LTD
Page 78
Version 2.0