SN8P2318 Series
C-type LCD, RFC 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 90
Version 1.5
8.4.2 T1 TIMER OPERATION
T1 timer is controlled by T1ENB bit. When T1ENB=0, T1 timer stops. When T1ENB=1, T1 timer starts to count. Before
enabling T1 timer, setup T1 timer’s configurations to select timer function modes, e.g. basic timer, interrupt
function…T1 16-bit counter (T1CH, T1CL) increases “1” by timer clock source. When T1 overflow event occurs, T1IRQ
flag is set as ”1” to indicate overflow and cleared by program. The overflow condition is T1CH, T1CL count from full
scale (0xFFFF) to zero scale (0x0000). T1 doesn’t build in double buffer, so load T1CH, T1CL by program when T1
timer overflows to fix the correct interval time. If T1 timer interrupt function is enabled (T1IEN=1), the system will
execute interrupt procedure. The interrupt procedure is system program counter points to interrupt vector (ORG 000FH)
and executes interrupt service routine after T1 overflow occurrence. Clear T1IRQ by program is necessary in interrupt
procedure. T1 timer can works in normal mode, slow mode and green mode.
0x0000 or “n”
by program
...
...
Clock
Source
T1CH, T1CL
T1IRQ
T1 timer overflows. T1IRQ set as “1”.
Reload T1CH, T1CL by program.
T1IRQ is cleared by program.
0x0001
or n+1
0xFFFE 0xFFFF
...
...
0x0000 or “n”
by program
0x0002
or n+2
0x0002
or n+2
T1 provides different clock sources to implement different applications and configurations. T1 clock source includes
Fcpu (instruction cycle) and Fhosc (high speed oscillator) controlled by T1CKS bit. T1CKS bit selects the clock source
is from Fcpu or Fhosc. If T1CKS=0, T1 clock source is Fcpu through T1rate[2:0] pre-scalar to decide Fcpu/1~Fcpu/128.
If T1CKS=1, T1 clock source is Fhosc. T1 length is 16-bit (65536 steps), and the one count period is each cycle of
input clock.
T1CKS
T1rate[2:0]
T1 Clock
T1 Interval Time
Fhosc=16MHz,
Fcpu=Fhosc/4
Fhosc=4MHz,
Fcpu=Fhosc/4
max. (ms) Unit (us) max. (ms) Unit (us)
0
000b
Fcpu/128
2097.152
32
8388.608
128
0
001b
Fcpu/64
1048.576
16
4194.304
64
0
010b
Fcpu/32
524.288
8
2097.152
32
0
011b
Fcpu/16
262.144
4
1048.576
16
0
100b
Fcpu/8
131.072
2
524.288
8
0
101b
Fcpu/4
65.536
1
262.144
4
0
110b
Fcpu/2
32.768
0.5
131.072
2
0
111b
Fcpu/1
16.384
0.25
65.536
1
1
-
Fhosc/1
4.096
0.0625
16.384
0.25