To avoid this problem, store a copy of the PCR3 data in a work area in memory. Perform the bit
manipulation on the data in the work area, then write this data to PCR3.
[A: Prior to executing BCLR]
MOV. B #3F
MOV. B R0L
MOV. B R0L
,
,
,
R0L
@RAM0
@PCR3
The PCR3 value (H'3F) is written to a work area in
memory (RAM0) as well as to PCR3.
P37
P36
P35
P34
P33
P32
P31
P30
Input/output
Pin state
Input
Input
Output
Output
Output
Output
Output
Output
Low
level
High
level
Low
level
Low
level
Low
level
Low
level
Low
level
Low
level
PCR3
PDR3
RAM0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
[B: BCLR instruction executed]
BSET #0 @RAM0
,
The BCLR instruction is executed designating the PCR3
work area (RAM0).
[C: After executing BCLR]
MOV. B @RAM0,
MOV. B R0L,
R0L
@PCR3
The work area (RAM0) value is written to PCR3.
P37
P36
P35
P34
P33
P32
P31
P30
Input/output
Pin state
Input
Input
Output
Output
Output
Output
Output
Output
Low
level
High
level
Low
level
Low
level
Low
level
Low
level
Low
level
High
level
PCR3
PDR3
RAM0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
61