Rev. 1.60
106
August 20, 2019
Rev. 1.60
107
August 20, 2019
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
TM Interrupts
The Compact, Standard or Periodic type TM has two internal interrupt, one for each of the internal
comparator A or comparator P, which generate a TM interrupt when a compare match condition
occurs. When a TM interrupt is generated, it can be used to clear the counter and also to change the
state of the TM output pin.
TM External Pins
Each of the TMs, irrespective of what type, has one or two TM input pins, with the label xTCKn and
xTPnI respectively. The xTMn input pin, xTCKn, is essentially a clock source for the xTMn and is
selected using the xTnCK2~xTnCK0 bits in the xTMnC0 register. This external TM input pin allows
an external clock source to drive the internal TM. The xTCKn input pin can be chosen to have either
a rising or falling active edge. The STCK and PTCK pins are also used as the external trigger input
pin in single pulse output mode for the STM and PTM respectively.
The other xTM input pin, STPI or PTPI, is the capture input whose active edge can be a rising edge,
a falling edge or both rising and falling edges and the active edge transition type is selected using
the STIO1~STIO0 or PTIO1~PTIO0 bits in the STMC1 or PTMC1 register respectively. There is
another capture input, PTCK, for PTM capture input mode, which can be used as the external trigger
input source except the PTPI pin.
The TMs each have two output pins, xTPn and xTPnB. The xTPnB is the inverted signal of the xTPn
output. The TM output pins can be selected using the corresponding pin-shared function selection
bits described in the Pin-shared Function section. When the TM is in the Compare Match Output
Mode, these pins can be controlled by the TM to switch to a high or low level or to toggle when a
compare match situation occurs. The external xTPn or xTPnB output pin is also the pin where the
TM generates the PWM output waveform. As the TM output pins are pin-shared with other functions,
the TM output function must first be setup using relevant pin-shared function selection register.
Device
CTM
STM
PTM
Input
Output
Input
Output
Input
Output
BS66F340
BS66F350
BS66F360
BS66F370
CTCK0
CTCK1
CTP0, CTP0B
CTP1, CTP1B STCK, STPI STP, STPB PTCK, PTPI PTP, PTPB
TM External Pins
TM Input/Output Pin Selection
Selecting to have a TM input/output or whether to retain its other shared function is implemented
using the relevant pin-shared function selection registers, with the corresponding selection bits in
each pin-shared function register corresponding to a TM input/output pin. Configuring the selection
bits correctly will setup the corresponding pin as a TM input/output. The details of the pin-shared
function selection are described in the pin-shared function section.
CTMn
CTCKn
CTPn
CCR output
CTPnB
CTM Function Pin Control Block Diagram – n = 0 or 1