Renesas F-ZTAT H8 Series Hardware Manual page 93

8-bit single-chip microcomputer
Hide thumbs Also See for F-ZTAT H8 Series:
Table of Contents

Advertisement

Bit Manipulation in a Register Containing a Write-Only Bit
Example 3: When a BCLR instruction is executed on PCR3 of port 3
As in the examples above, P3
high-level signal at P3
signals. In this example, the BCLR instruction is used to change pin P3
assumed that a high-level signal will be input to this input pin.
[A: Prior to executing BCLR]
P3
7
Input/output
Input
Pin state
Low
level
PCR3
0
PDR3
1
[B: BCLR instruction executed]
BCLR
#0
,
[C: After executing BCLR]
P3
7
Input/output
Output
Pin state
Low
level
PCR3
1
PDR3
1
[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.
and P3
are input pins, with a low-level signal input at P3
7
6
. The remaining pins, P3
6
P3
P3
6
5
Input
Output
High
Low
level
level
0
1
0
0
The BCLR instruction is executed designating PCR3.
@PCR3
P3
P3
6
5
Output
Output
High
Low
level
level
1
1
0
0
to P3
, are output pins that output low-level
5
0
P3
P3
4
3
Output
Output
Low
Low
level
level
1
1
0
0
P3
P3
4
3
Output
Output
Low
Low
level
level
1
1
0
0
Rev.3.00 Jul. 19, 2007 page 67 of 532
and a
7
to an input port. It is
0
P3
P3
P3
2
1
Output
Output
Output
Low
Low
Low
level
level
level
1
1
1
0
0
0
P3
P3
P3
2
1
Output
Output
Input
Low
Low
High
level
level
level
1
1
0
0
0
0
REJ09B0397-0300
2. CPU
0
0

Advertisement

Table of Contents
loading

Table of Contents