
Rev. 1.00
78
October 26, 2018
Rev. 1.00
79
October 26, 2018
BS86DH12C
High Voltage Touch A/D Flash MCU with HVIO
BS86DH12C
High Voltage Touch A/D Flash MCU with HVIO
comparators. When the free running count-up counter has the same value as the pre-programmed
comparator, known as a compare match situation, a TM interrupt signal will be generated which
can clear the counter and perhaps also change the condition of the TM output pin. The internal TM
counter is driven by a user selectable clock source, which can be an internal clock or an external pin.
TM Clock Source
The clock source which drives the main counter in each TM can originate from various sources.
The selection of the required clock source is implemented using the xTnCK2~xTnCK0 bits in the
xTMn control registers, where “x” stands for C or P type TM and “n” stands for the specific TM
serial number. For the PTM there is no serial number “n” in the relevant pins, registers and control
bits since there is only one PTM in the device. The clock source can be a ratio of the system clock,
f
SYS
, or the internal high clock, f
H
, the f
SUB
clock source or the external xTCKn pin. The xTCKn pin
clock source is used to allow an external signal to drive the TM as an external clock source for event
counting.
TM Interrupts
The Compact or Periodic type TM each 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 input pin with the label xTCKn while the
Periodic TM has another input pin with the label PTPI. 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 PTCK pin is also used as
the external trigger input pin in single pulse output mode for the PTM.
The other PTM input pin, 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
PTIO1~PTIO0 bits in the PTMC1 register. 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. 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 and xTPnB output pins are also the pins
where the xTMn generates the PWM output waveform.
As the TM input and output pins are pin-shared with other functions, the TM input and output
functions must first be configured using the relevant pin-shared function selection bits described in
the Pin-shared Function section. The details of the pin-shared function selection are described in the
pin-shared function section.
CTM0
CTM1
PTM
Input
Output
Input
Output
Input
Output
CTCK0
CTP0, CTP0B
CTCK1
CTP1, CTP1B
PTCK, PTPI
PTP, PTPB
TM External Pins