18
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
P46
P45
P44
P43
P42
P41
P40
Input/output
Input
Input
Output
Output
Output
Output
Output
Output
Pin state
Low
High
Low
Low
Low
Low
Low
Low
PCR4
0
0
1
1
1
1
1
1
PDR4
1
0
0
0
0
0
0
0
Execution of BSET Instruction
BSET
#0 @PDR4
;set bit 0 in port 4 port data register
After Execution of BSET Instruction
P47
P46
P45
P44
P43
P42
P41
P40
Input/output
Input
Input
Output
Output
Output
Output
Output
Output
Pin state
Low
High
Low
Low
Low
Low
Low
High
PCR4
0
0
1
1
1
1
1
1
PDR4
0
1
0
0
0
0
0
1
Summary of Contents for H8/300L Series
Page 1: ...H8 300L Series Programming Manual ...
Page 6: ...iv ...
Page 8: ...2 ...
Page 11: ......
Page 14: ......
Page 46: ......
Page 48: ......
Page 60: ......
Page 83: ......
Page 116: ......
Page 150: ...144 ...
Page 151: ......
Page 156: ...150 ...