Datasheet

Section 2 CPU
Rev. 6.00 Mar. 18, 2010 Page 101 of 982
REJ09B0054-0600
Write data to the work area
Write the work area data to the
register that includes write-only bits
Access the work area data
(data transfer and bit manipulation
instructions can be used)
Write the work area data to the register
that includes write-only bits
Initial value write
Modifying the value of a registe
r
that includes write-only bits
Figure 2.14 Flowchart for Access Methods for Registers That Include Write-Only Bits
Example: To clear only bit 4 in the port 1 P1DDR
The P1DDR register consists of 8 write-only bits and sets the I/O direction of the port 1 pins.
Reading this register is invalid. When read, the values returned are undefined.
Here we present an example in which P14 is specified to be an input port using the BCLR
instruction. First, we write the initial value H'F0 written to P1DDR to the work area in RAM
(RAM0).
MOV.B #H'F0, R0L
MOV.B R0L, @PAM0
MOV.B R0L, @P1DDR
P17 P16 P15 P14 P13 P12 P11 P10
I/O Output Output Output Output Input Input Input Input
P1DDR 1 1 1 1 0 0 0 0
RAM0 1 1 1 1 0 0 0 0