SN8P2318 Series
C-type LCD, RFC 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 80
Version 1.5
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
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
T0M
T0ENB
T0rate2
T0rate1
T0rate0
-
-
-
T0TB
Read/Write
R/W
R/W
R/W
R/W
-
-
-
R/W
After reset
0
0
0
0
-
-
-
0
Bit 0
T0TB:
RTC clock source control bit.
0 = Disable RTC (T0 clock source from Fcpu).
1 = Enable RTC.
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.
Note: T0RATE is not available in RTC mode. The T0 interval time is fixed at 0.5 sec.
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 first cycle correct. After one T0 overflow occurs, the T0C
register is loaded a correct value by program.
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
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
After reset
0
0
0
0
0
0
0
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 = 4MHz/4 = 1MHz.
Select T0RATE=001 (Fcpu/128).
T0 interval time = 10ms. T0 clock rate = 4MHz/4/128
T0C initial value = 256 - (T0 interval time * input clock)
= 256 - (10ms * 4MHz / 4 / 128)
= 256 - (10
-2
* 4 * 10
6
/ 4 / 128)
= B2H
Note: In RTC mode, T0C is 256 counts and generatesT0 0.5 sec interval time. Don
’t change T0C value in
RTC mode.