Renesas H8/38024 Hardware Manual page 97

8-bit single-chip microcomputer h8 family/h8/300l super low power series
Hide thumbs Also See for H8/38024:
Table of Contents

Advertisement

Example 2: BSET instruction executed designating port 3
P3
and P3
are designated as input pins, with a low-level signal input at P3
7
6
signal at P3
. The remaining pins, P3
6
example, the BSET instruction is used to change pin P3
[A: Prior to executing BSET]
P3
7
Input/output Input
Pin state
Low level High level Low level Low level Low level Low level Low level Low level
PCR3
0
PDR3
1
[B: BSET instruction executed]
BSET
#0
,
[C: After executing BSET]
P3
7
Input/output Input
Pin state
Low level High level Low level Low level Low level Low level Low level High level
PCR3
0
PDR3
0
[D: Explanation of how BSET operates]
When the BSET instruction is executed, first the CPU reads port 3.
Since P3
and P3
are input pins, the CPU reads the pin states (low-level and high-level input).
7
6
P3
to P3
are output pins, so the CPU reads the value in PDR3. In this example PDR3 has a value
5
0
of H'80, but the value read by the CPU is H'40.
Next, the CPU sets bit 0 of the read data to 1, changing the PDR3 data to H'41. Finally, the CPU
writes this value (H'41) to PDR3, completing execution of BSET.
As a result of this operation, bit 0 in PDR3 becomes 1, and P3
However, bits 7 and 6 of PDR3 end up with different values.
To avoid this problem, store a copy of the PDR3 data in a work area in memory. Perform the bit
manipulation on the data in the work area, then write this data to PDR3.
to P3
5
P3
P3
6
5
Input
Output
0
1
0
0
The BSET instruction is executed designating port 3.
@PDR3
P3
P3
6
5
Input
Output
0
1
1
0
, are output pins and output low-level signals. In this
1
to high-level output.
0
P3
P3
4
3
Output
Output
1
1
0
0
P3
P3
4
3
Output
Output
1
1
0
0
outputs a high-level signal.
0
and a high-level
7
P3
P3
2
1
Output
Output
1
1
0
0
P3
P3
2
1
Output
Output
1
1
0
0
Rev. 6.00, 08/04, page 67 of 628
P3
0
Output
1
0
P3
0
Output
1
1

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8/38024f-ztatH8/38124H8/38024s

Table of Contents