SN8P2501D
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD Page 70 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.
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.
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.