Rev. 1.00
52
March 24, 2020
Rev. 1.00
53
March 24, 2020
BS83A04C
4-Key Enhanced Touch I/O Flash MCU
BS83A04C
4-Key Enhanced Touch I/O Flash MCU
The TM has two output pins with the label CTP and CTPB. 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 CTP and CTPB output pins are also the pins
where the TM generates the PWM output waveform. As the TM input and output pins are pin-shared
with other functions, the TM input and output function must first be setup using relevant pin-shared
function selection register described in the Pin-shared Function section.
CTM
Input
Output
CTCK
CTP, CTPB
CTM External Pins
CTM
CTCK
CTP
CCR output
CTPB
CTM Function Pin Block Diagram
Programming Considerations
The TM Counter Registers and the Capture/Compare CCRA registers, all have a low and high byte
structure. The high bytes can be directly accessed, but as the low bytes can only be accessed via an
internal 8-bit buffer, reading or writing to these register pairs must be carried out in a specific way.
The important point to note is that data transfer to and from the 8-bit buffer and its related low byte
only takes place when a write or read operation to its corresponding high byte is executed.
As the CCRA registers are implemented in the way shown in the following diagram and accessing
this register pair is carried out in a specific way described above, it is recommended to use the
“MOV” instruction to access the CCRA low byte register, named CTMAL, in the following access
procedures. Accessing the CCRA low byte register without following these access procedures will
result in unpredictable values.
Data Bus
8-bit Buffer
CTMDH
CTMDL
CTMAH
CTMAL
CTM Counter Register (Read only)
CTM CCRA Register (Read/Write)
The following steps show the read and write procedures:
• Writing Data to CCRA
♦
Step 1. Write data to Low Byte CTMAL
–
Note that here data is only written to the 8-bit buffer.
♦
Step 2. Write data to High Byte CTMAH
– Here data is written directly to the high byte registers and simultaneously data is latched
from the 8-bit buffer to the Low Byte registers.