Datasheet

Section 2 CPU
Rev. 6.00 Mar. 18, 2010 Page 102 of 982
REJ09B0054-0600
To switch P14 from being an output pin to being an input pin, we must change the value of
P1DDR bit 4 from 1 to 0 (H'F0 H'E0). Here, were execute a BCLR instruction for RAM0.
BCLR #4, @RAM0
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
0 0 0 0 0
Since RAM0 can be read and written, when the bit manipulation instruction is executed, only bit 4
in RAM0 is cleared. Then we write this RAM0 value to P1DDR.
MOV.B @RAM0, R0L
MOV.B R0L, @P1DDR
P17 P16 P15 P14 P13 P12 P11 P10
I/O Output Output Output Input Input Input Input Input
P1DDR 1 1 1 0 0 0 0 0
RAM0 1 1 1
0 0 0 0 0
If this procedure is used to write registers that include write-only bits, programs can be written
without depending on the type of the instructions used.