17
Notes on Bit Manipulation Instructions: BSET, BCLR, BNOT, BST, and BIST are read-
modify-write instructions. They read a byte of data, modify one bit in the byte, then write the
byte back. Care is required when these instructions are applied to registers with write-only bits
and to the I/O port registers.
Sequence
Operation
1 Read
Read one data byte at the specified address
2 Modify
Modify one bit in the data byte
3 Write
Write the modified data byte back to the specified address
Example 1: BCLR is executed to clear bit 0 in port control register 4 (PCR4) under the
following conditions.
P47:
Input pin, Low
P46:
Input pin, High
P45 - P40:
Output pins, Low
The intended purpose of this BCLR instruction is to switch P40 from output to input.
Before Execution of BCLR 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 BCLR Instruction
BCLR
#0 @PCR4
;clear bit 0 in PCR4
After Execution of BCLR Instruction
P47
P46
P45
P44
P43
P42
P41
P40
Input/output
Output
Output
Output
Output
Output
Output
Output
Input
Pin state
Low
High
Low
Low
Low
Low
Low
High
PCR4
1
1
1
1
1
1
1
0
PDR4
1
0
0
0
0
0
0
0
Содержание H8/300L Series
Страница 1: ...H8 300L Series Programming Manual ...
Страница 6: ...iv ...
Страница 8: ...2 ...
Страница 11: ......
Страница 14: ......
Страница 46: ......
Страница 48: ......
Страница 60: ......
Страница 83: ......
Страница 116: ......
Страница 150: ...144 ...
Страница 151: ......
Страница 156: ...150 ...