Hitachi H8/300L Series Programming Manual page 24

Hide thumbs Also See for H8/300L Series:
Table of Contents

Advertisement

Explanation: To execute the BCLR instruction, the CPU begins by reading PCR4. Since PCR4
is a write-only register, it is read as H'FF, even though its true value is H'3F.
Next the CPU clears bit 0 of the read data, changing the value to H'FE.
Finally, the CPU writes this value (H'FE) back to PCR4 to complete the BCLR instruction.
As a result, bit 0 in PCR4 is cleared to 0, making P40 an input pin. In addition, bits 7 and 6 in
PCR4 are set to 1, making P47 and P46 output pins.
Example 2: BSET is executed to set bit 0 in the port 4 port data register (PDR4) under the
following conditions.
P47:
Input pin, Low
P46:
Input pin, High
P45 P40:
Output pins, Low
The intended purpose of this BSET instruction is to switch the output level at P40 from Low to
High.
Before Execution of BSET Instruction
P47
Input/output
Input
Pin state
Low
PCR4
0
PDR4
1
Execution of BSET Instruction
BSET
#0 @PDR4 ;set bit 0 in port 4 port data register
After Execution of BSET Instruction
P47
Input/output
Input
Pin state
Low
PCR4
0
PDR4
0
18
P46
P45
P44
Input
Output
Output
High
Low
Low
0
1
1
0
0
0
P46
P45
P44
Input
Output
Output
High
Low
Low
0
1
1
1
0
0
P43
P42
P41
Output
Output
Output
Low
Low
Low
1
1
1
0
0
0
P43
P42
P41
Output
Output
Output
Low
Low
Low
1
1
1
0
0
0
P40
Output
Low
1
0
P40
Output
High
1
1

Advertisement

Table of Contents
loading

Table of Contents