MS51
Nov. 28, 2019
Page
314
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
6.5.3
TIMER 3
Overview
6.5.3.1
Timer 3 is implemented simply as a 16-bit auto-reload, up-counting timer. The user can select the pre-
scale with T3PS[2:0] (T3CON[2:0]) and fill the reload value into RH3 and RL3 registers to determine
its overflow rate. User then can set TR3 (T3CON.3) to start counting. When the counter rolls over
FFFFH, TF3 (T3CON.4) is set as 1 and a reload is generated and causes the contents of the RH3 and
RL3 registers to be reloaded into the internal 16-bit counter. If ET3 (EIE1.1) is set as 1, Timer 3
interrupt service routine will be served. TF3 is auto-cleared by hardware after entering its interrupt
service routine.
Timer 3 can also be the baud rate clock source of both UARTs. For details, please see Section
6.9.3
RL3
TR3
(T3CON.3)
F
SYS
Internal 16-bit Counter
0
7
RH3
0
7
Timer 3
Overflow
Pre-scalar
(1/1~1/128)
T3PS[2:0]
(T3CON[2:0])
TF3
(T3CON.4)
Timer 3 Interrupt
Figure 6.5-8 Timer 3 Block Diagram
Control Registers of Timer 3
6.5.3.2
T3CON
– Timer 3 Control
Register
SFR Address
Reset Value
T3CON
C4H, Page 0
0000_0000 b
7
6
5
4
3
2
1
0
SMOD_1
SMOD0_1
BRCK
TF3
TR3
T3PS[2:0]
R/W
R/W
R/W
R/W
R/W
R/W
Bit
Name
Description
4
TF3
Timer 3 overflow flag
This bit is set when Timer 3 overflows. It is automatically cleared by hardware when the program
executes the Timer 3 interrupt service routine. This bit can be set or cleared by software.
3
TR3
Timer 3 run control
0 = Timer 3 is halted.
1 = Timer 3 starts running.
Note that the reload registers RH3 and RL3 can only be written when Timer 3 is halted (TR3 bit
is 0). If any of RH3 or RL3 is written if TR3 is 1, result is unpredictable.