8051 bit set instruction and bit addresses Consider the 8051 statement: SETB 01H Does this instruction set the bit at bit address 01H to logic 1?
-
ATrue
-
BFalse
-
CIt clears the bit at 01H to 0
-
DInvalid, 01H is not bit-addressable
Answer
Correct Answer: True
Explanation
Introduction / Context:The 8051 includes instructions for single bit manipulation. SETB sets a specified bit to logic 1. Bits may refer to SFR bits or bits in the bit-addressable low RAM region. Understanding how numeric bit addresses map to byte addresses is key to using these instructions correctly.
Given Data / Assumptions:
- Instruction is SETB 01H with a numeric bit address.
- Bit addresses 00H to 7FH correspond to low RAM bit space mapped onto bytes 20H to 2FH.
- No operand refers to R0 or R1, so this is not indirect addressing.
Concept / Approach:
SETB bit_address sets the specified bit to 1. The low RAM bit space uses a linear mapping: bit_address = (byte_address * 8) + bit_index. The lowest bit address 00H corresponds to byte 20H bit 0; therefore 01H corresponds to byte 20H bit 1. The instruction is valid and performs a set operation.
Step-by-Step Solution:
Recognize SETB with a direct bit address operand.Map 01H to the low RAM bit space: it is the second bit in byte 20H.Execute conceptually: the CPU sets that bit to logic 1.No SFR is involved unless an SFR bit address is specified.Verification / Alternative check:
Assemble and single step in a simulator: memory byte 20H toggles bit 1 to 1; PSW flags are unaffected.
Why Other Options Are Wrong:
False: contradicts the defined behavior of SETB.
It clears the bit: would be the effect of CLR, not SETB.
Invalid address: 01H is valid within the 00H–7FH bit address range.
Common Pitfalls:
Confusing bit addresses with byte addresses and assuming all bytes are bit-addressable. Only the 20H–2FH byte range and specific SFRs support bit addressing.
Final Answer:
True