![Sino Wealth SH69K55A Manual Download Page 24](http://html1.mh-extra.com/html/sino-wealth/sh69k55a/sh69k55a_manual_1283061024.webp)
SH69P55A/K55A
24
7.4. Timer2
Timer2 is a 16-bit timer and it has the following features:
- 16-bit up-counting timer/counter.
- Automatic re-load counter.
- 8-level prescaler.
- Interrupt on overflow from $FFFF to $0000.
The following is a simplified Timer2 block diagram.
Prescaler
System
clock
t
OSC
SYNC
16-BIT
COUNTER
SC.2
SC.0
SC.1
EOR
T2E TMS1
T2
MUX
TMS0
The Timer2 provides the following functions:
- Programmable interval timer function.
- Read counter value.
7.5. Timer2 Configuration and Operation
Timer2 consists of a 16-bit write-only timer load register
(TL2L, TL2ML, TL2MH, TL2H) and a 16-bit read-only timer
counter (TC2L, TC2ML, TC2MH, TC2H). Each of them has
low-order digits and high-order digits. Writing data into the
timer load register (TL2L, TL2ML, TL2MH, TL2H) can
initialize the timer counter.
The low-order digit should be written first, and then the
high-order digit. The timer counter is automatically loaded with
the contents of the load register when the high order digit is
written or the counter counts overflow from $FFFF to $0000.
Timer Load Register: Since the register H controls the
physical READ and WRITE operations.
Please follow these steps:
Write Operation:
Low nibble first
High nibble to update the counter
Read Operation:
High nibble first
Low nibble followed.
Load Reg. H
16-bit timer counter
Load Reg. L
Latch Reg. L
Latch Reg. H
7.6. Timer2 Control Register
The Timer2 can be programmed in several different modes: timer, external event counter, and external trigger timer and pulse
width measurement.
Timer2 Control Register: $27
Address
Bit 3
Bit 2
Bit 1
Bit 0
R/W
Remarks
$27 T2GO DEC TM2S1
TM2S0
R/W
Bit1-0: Timer2 mode select register
Bit3: Set Timer2 function start register
X
X
0
0
R/W Timer with internal system clock
X
X
0
1
R/W Event counter with external clock (T2 pin input)
X
X
1
0
R/W Timer with external trigger (T2 pin input)
X
X
1
1
R/W Pulse width measurement (T2 pin input)
0 X X X
R/W
Timer/counter stops
(Read: status; Write: command) (default)
1 X X X
R/W
Timer/counter starts
(Read: status; Write: command)
Note:
Before using event counter mode, timer with external trigger mode or pulse width measurement mode, the $3C2 bit3 must be
cleared to 0.