Rev. 1.20
72
�an�a�� 2�� 201�
Rev. 1.20
7�
�an�a�� 2�� 201�
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
Programming Considerations
The TM Counter Registers and the Capture/Compare CCRA and CCRP registers, being 10-bit, 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 and CCRP registers
are
implemented in the way shown in the following diagram and
accessing these registers is carried out in a specific way described above, it is recommended to use
the "MOV" instruction to access the CCRA and CCRP low byte registers, named
xTMn
AL and
PTMnRPL, in the following access procedures. Accessing the CCRA or CCRP low byte register
without following these access procedures will result in unpredictable values.
Data B�s
8-bit
B�ffe�
xTMnDH
xTMnDL
xTMnAH
xTMnAL
xTMn Co�nte� Registe� (Read onl�)
xTMn CCRA Registe�
(Read/W�ite)
PTMn CCRP Registe� (Read/W�ite)
PTMnRPH
PTMnRPL
The following steps show the read and write procedures:
• Writing Data to CCRA or CCRP
♦
Step 1. Write data to Low Byte
xTMn
AL or PTMnRPL
–
note that here data is only written to the 8-bit buffer.
♦
Step 2. Write data to High Byte
xTMn
AH or PTMnRPH
–
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.
• Reading Data from the Counter Registers and CCRA or CCRP
♦
Step 1. Read data from the High Byte
xTMn
DH,
xTMn
AH or PTMnRPH
–
here data is read directly from the High Byte registers and simultaneously data is latched
from the Low Byte register into the 8-bit buffer.
♦
Step 2. Read data from the Low Byte
xTMn
DL,
xTMn
AL or PTMnRPL
–
this step reads data from the 8-bit buffer.
Содержание BS82B12A-3
Страница 33: ...Rev 1 20 33 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 34: ...Rev 1 20 34 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 35: ...Rev 1 20 35 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...