Notes On Use Of Bit Manipulation Instructions - Hitachi H8/3008 Hardware Manual

16-bit microcomputer
Table of Contents

Advertisement

Operation field only
Operation field and register fields
Operation field, register fields, and effective address extension
Operation field, effective address extension, and condition field
op
2.6.5

Notes on Use of Bit Manipulation Instructions

The BSET, BCLR, BNOT, BST, and BIST instructions read a byte of data, modify a bit in the
byte, then write the byte back. Care is required when these instructions are used to access registers
with write-only bits, or to access ports.
Step
1
Read
2
Modify
3
Write
Example 1: BCLR is executed to clear bit 0 in the port 4 data direction register (P4DDR) under
the following conditions.
P4
, P4
:
Input pins
7
6
P4
– P4
: Output pins
5
0
The intended purpose of this BCLR instruction is to switch P4
op
op
op
EA (disp)
cc
Figure 2.9 Instruction Formats
Description
Read one data byte at the specified address
Modify one bit in the data byte
Write the modified data byte back to the specified address
rn
rm
rn
rm
EA (disp)
0
NOP, RTS, etc.
ADD.B Rn, Rm, etc.
MOV.B @(d:16, Rn), Rm
BRA d:8
from output to input.
39

Advertisement

Table of Contents
loading

Table of Contents