174
9.3.3
Interface with the CPU
TCF and OCRF are 16-bit read/write registers, whereas the data bus between the CPU and on-chip
peripheral modules has an 8-bit width. For this reason, when the CPU accesses TCF or OCRF, it
makes use of an 8-bit temporary register (TEMP).
In 16-bit mode, when reading or writing TCF or writing OCRF, always use two consecutive byte
size MOV instructions, and always access the upper byte first. Data will not be transferred
properly if only the upper byte or only the lower byte is accessed. In 8-bit mode there is no such
restriction on the order of access.
Write Access: When the upper byte is written, the upper-byte data is loaded into the TEMP
register. Next when the lower byte is written, the data in TEMP goes to the upper byte of the
register, and the lower-byte data goes directly to the lower byte of the register. Figure 9.3 shows a
TCF write operation when H'AA55 is written to TCF.
Read Access: When the upper byte of TCF is read, the upper-byte data is sent directly to the CPU,
and the lower byte is loaded into TEMP. Next when the lower byte is read, the lower byte in
TEMP is sent to the CPU.
When the upper byte of OCRF is read, the upper-byte data is sent directly to the CPU. Next when
the lower byte is read, the lower-byte data is sent directly to the CPU.
Figure 9.4 shows a TCF read operation when H'AAFF is read from TCF.