Periodic Type TM – PTM
The Periodic Type TM contains five operating modes, which are Compare Match Output, Timer/Event
Counter, Capture Input, Single Pulse Output and PWM Output modes. The Periodic TM can be controlled
with two external input pins and can drive two external output pins.
BS66F340C
BS66F350C
BS66F360C
f
/4
000
SYS
001
f
SYS
f
/16
010
SYS
f
/64
011
SYS
f
100
SUB
f
101
SUB
PTON
PTPAU
110
PTCK
111
PTCK2~PTCK0
Note: 1. The PTM external pins are pin-shared with other functions, so before using the PTM function, ensure that
the pin-shared function registers have be set properly to enable the PTM pin function. The PTCK and PTPI
pins, if used, must also be set as an input by setting the corresponding bits in the port control register.
2. The PTPB is the inverted signal of the PTP.
Periodic TM Operation
The size of the Periodic type TM is 10-bit wide and its core is a 10-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 and the CCRA comparators are both 10-bit
wide whose values are compared with all the bits in the counter.
The only way of changing the value of the 10-bit counter using the application program, is to
clear the counter by changing the PTON 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 PTM interrupt signal will also usually be generated. The Periodic
Type TM can operate in a number of different operational modes, can be driven by different clock
sources including external input pins and can also control more than one output pins. All operating
setup conditions are selected using relevant internal registers.
Periodic Type TM Register Description
Overall operation of the Periodic Type TM is controlled using a series of registers. A read only
register pair exists to store the internal counter 10-bit value, while two read/write register pairs exist
to store the internal 10-bit CCRA value and CCRP value. The remaining two registers are control
registers which setup the different operating and control modes.
Rev. 1.11
BS66F340C/BS66F350C/BS66F360C
Device
PTM Core
10-bit PTM
CCRP
Comparator P Match
10-bit Comparator P
b0~b9
Counter Clear
10-bit Count-up Counter
b0~b9
Comparator A Match
10-bit Comparator A
PTIO1, PTIO0
CCRA
Detector
10-bit Periodic Type TM Block Diagram
146
Touch A/D Flash MCU
PTM Input Pin
PTM Output Pin
PTCK, PTPI
PTP, PTPB
PTMPF Interrupt
PTOC
Output
Polarity
0
1
Control
Control
PTCCLR
PTM1, PTM0
PTIO1, PTIO0
PTMAF Interrupt
PTCAPTS
Edge
0
PTPI
1
PTP
PTPB
PTPOL
November 09, 2023
Need help?
Do you have a question about the BS66F340C and is the answer not in the manual?