Rev. 1.00
80
September 11, 2018
Rev. 1.00
81
September 11, 2018
HT45F4050
A/D NFC Flash MCU
HT45F4050
A/D NFC Flash MCU
Compact Type TM – CTM
Although the simplest form of the three TM types, the Compact TM type still contains three
operating modes, which are Compare Match Output, Timer/Event Counter and PWM Output modes.
The Compact TM can also be controlled with an external input pin and can drive two external output
pin
s
.
CTM Core
CTM Input Pin
CTM Output Pin
16-bit CTM
CTCK
CTP, CTPB
f
SYS
f
SYS
/4
f
H
/64
f
H
/16
f
SUB
f
SUB
CTCK
000
001
010
011
100
101
110
111
CTCK2~CTCK0
16-bit Count-up Counter
8-bit Comparator P
CCRP
b8~b15
b0~b15
16-bit Comparator A
CTON
CTPAU
Comparator A Match
Comparator P Match
Counter Clear
0
1
Output
Control
Polarity
Control
Pin
Control
CTP
CTOC
CTM1, CTM0
CTIO1, CTIO0
CTMAF Interrupt
CTMPF Interrupt
CTPOL
PxSn
CCRA
CTCCLR
CTPB
Pin
Control
PxSn
IFS0
Compact Type TM Block Diagram
Compact Type TM Operation
At its core is a 16-bit count-up counter which is driven by a user selectable internal or external clock
source. There are also two internal comparators with the names, Comparator A and Comparator
P. These comparators will compare the value in the counter with CCRP and CCRA registers. The
CCRP is 8-bit wide whose value is compared with the highest eight bits in the counter while the
CCRA is 16-bit wide and therefore compares with all counter bits.
The only way of changing the value of the 16-bit counter using the application program, is to
clear the counter by changing the CTON bit from low to high. The counter will also be cleared
automatically by a counter overflow or a compare match with one of its associated comparators.
When these conditions occur, a CTM interrupt signal will also usually be generated. The Compact
Type TM can operate in a number of different operational modes, can be driven by different clock
sources including an input pin and can also control two output pins. All operating setup conditions
are selected using relevant internal registers.
Compact Type TM Register Description
Overall operation of the Compact TM is controlled using a series of registers. A read only register
pair exists to store the internal counter 16-bit value, while a read/write register pair exists to store
the internal 16-bit CCRA value. The CTMRP register is used to store the 8-bit CCRP value. The
remaining two registers are control registers which setup the different operating and control modes.
Register
Name
Bit
7
6
5
4
3
2
1
0
CTMC0
CTPAU
CTCK2
CTCK1
CTCK0
CTON
—
—
—
CTMC1
CTM1
CTM0
CTIO1
CTIO0
CTOC
CTPOL
CTDPX CTCCLR
CTMDL
D7
D6
D5
D4
D3
D2
D1
D0
CTMDH
D15
D14
D13
D12
D11
D10
D9
D8
CTMAL
D7
D6
D5
D4
D3
D2
D1
D0
CTMAH
D15
D14
D13
D12
D11
D10
D9
D8
CTMRP
CTRP7
CTRP6
CTRP5
CTRP4
CTRP3
CTRP2
CTRP1
CTRP0
16-bit Compact TM Registers List