Difficulty: Medium
Correct Answer: False
Explanation:
Introduction / Context:This question tests precise bit masking and comparison in 8051 assembly. Correctly identifying which bit is being tested requires understanding hexadecimal masks and the CJNE instruction semantics.
Given Data / Assumptions:
Concept / Approach:Bit values are: bit0 = 01H, bit1 = 02H, bit2 = 04H, etc. Applying ANL A, #02H zeroes all bits except bit1. If bit1 is high, A becomes 02H; if bit1 is low, A becomes 00H. The CJNE A, #02H, READ loops until A equals 02H (bit1 set). Therefore, the code checks bit1, not bit2.
Step-by-Step Solution:
1) After MOV A, P1, accumulator contains P1 value.2) ANL A, #02H keeps only bit1.3) If bit1 = 1, A = 02H; else A = 00H.4) CJNE A, #02H, READ branches back unless A equals 02H.5) When A = 02H, the loop exits and MOV P3, #0FFH executes.Verification / Alternative check:Had the intention been to test bit2, the mask should be #04H and the comparison should be #04H accordingly.
Why Other Options Are Wrong:
Common Pitfalls:Off-by-one errors in bit masks (confusing bit numbering with 1-based human counting). Always map bit n to 1 << n: bit2 corresponds to 04H.
Final Answer:False
Discussion & Comments