SN8P1700
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 113
Revision 1.93
BASIC TIMER 0 (T0)
OVERVIEW
The basic timer (T0) is an 8-bit binary up counter. It uses T0M register to select T0C’s input clock for counting a
precision time. If the T0 timer has occur an overflow (from FFH to 00H), it will continue counting and issue a time-out
signal to trigger T0 interrupt to request interrupt service. The main purposes of the T0 basic timer is as following.
8-bit programmable timer:
Generates interrupts at specific time intervals based on the selected clock
frequency.
Figure 7-2. Basic Timer T0 Block Diagram
T0M REGISTER DESCRIPTION
The T0M is the basic timer mode register which is a 8-bit read/write register and only used the high nibble. By loading
different value into the T0M register, users can modify the basic timer clock dynamically as program executing.
Eight rates for T0 timer can be selected by T0RATE0 ~ T0RATE2 bits. The range is from fcpu/2 to fcpu/256. The T0M
initial value is zero and the rate is fcpu/256. The bit7 of T0M called T0ENB is the control bit to start T0 timer. The
combination of these bits is to determine the T0 timer clock frequency and the intervals.
T0M initial value = 0000 xxxx
0D8H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
T0M
T0ENB T0RATE2 T0RATE1 T0RATE0
0
0
0
0
R/W R/W R/W R/W -
-
-
-
T0ENB: T0 timer control bit. 0 = disable, 1 = enable.
T0RATE2~T0RATE0: The T0 timer’s clock source select bits. 000 = fcpu/256, 001 = fcpu/128, … , 110 = fcpu/4, 111 =
fcpu/2.
T0enb
T0C 8-bit binary counter
T0 Time out
pre_load
Internal data bus
÷
2
(8-T0Rate)
f
cpu
T0enb
T0C 8-bit binary counter
T0 Time out
pre_load
Internal data bus
÷
2
(8-T0Rate)
f
cpu