English
Language : 

HD64F3644PV Datasheet, PDF (77/551 Pages) Renesas Technology Corp – Old Company Name in Catalogs and Other Documents
Section 2 CPU
Bit Manipulation in a Register Containing a Write-Only Bit
Example 3: BCLR instruction executed designating port 3 control register PCR3
As in the examples above, P37 and P36 are input pins, with a low-level signal input at P37 and a
high-level signal at P36. The remaining pins, P35 to P30, are output pins that output low-level
signals. In this example, the BCLR instruction is used to change pin P30 to an input port. It is
assumed that a high-level signal will be input to this input pin.
[A: Prior to executing BCLR]
Input/output
Pin state
PCR3
PDR3
P37
Input
Low
level
0
1
P36
Input
High
level
0
0
P35
Output
Low
level
1
0
P34
Output
Low
level
1
0
P33
Output
Low
level
1
0
P32
Output
Low
level
1
0
P31
Output
Low
level
1
0
P30
Output
Low
level
1
0
[B: BCLR instruction executed]
BCLR #0 , @PCR3
The BCLR instruction is executed designating PCR3.
[C: After executing BCLR]
Input/output
Pin state
PCR3
PDR3
P37
Output
Low
level
1
1
P36
Output
High
level
1
0
P35
Output
Low
level
1
0
P34
Output
Low
level
1
0
P33
Output
Low
level
1
0
P32
Output
Low
level
1
0
P31
Output
Low
level
1
0
P30
Input
High
level
0
0
[D: Explanation of how BCLR operates]
When the BCLR instruction is executed, first the CPU reads PCR3. Since PCR3 is a write-only
register, the CPU reads a value of H'FF, even though the PCR3 value is actually H'3F.
Next, the CPU clears bit 0 in the read data to 0, changing the data to H'FE. Finally, this value
(H'FE) is written to PCR3 and BCLR instruction execution ends.
Rev. 6.00 Sep 12, 2006 page 55 of 526
REJ09B0326-0600