8051 logical OR practice — OR with zero (immediate) Compute the accumulator after these two instructions (shown with real newlines). Assume immediate OR with zero (#00H): MOV A, #2BH ORL A, #00H

Difficulty: Easy

Correct Answer: 2B H

Explanation:


Introduction / Context:
This checks understanding of the ORL instruction and the difference between immediate and direct addressing. ORing any value with 00H (immediate) leaves the value unchanged; ORing with a direct address would depend on that RAM location's content.


Given Data / Assumptions:

  • The code sequence is interpreted as immediate OR: ORL A, #00H.
  • MOV A, #2BH loads 0x2B (binary 0010 1011) into A.
  • OR with 0x00 immediate should not modify the accumulator.


Concept / Approach:
OR rules: x OR 0 = x. Immediate addressing (prefixed with #) uses the literal constant. Therefore, A remains 0x2B after ORL A, #00H.


Step-by-Step Solution:

1) Initial A = 0x2B.2) Execute ORL A, #00H → A = 0x2B OR 0x00 = 0x2B.3) Convert to the expected answer format: “2B H”.4) Select the option matching 2B H.


Verification / Alternative check:
Binary check: 0010 1011 OR 0000 0000 = 0010 1011 (unchanged).


Why Other Options Are Wrong:

  • 1B H, 3B H, 4B H: these would require setting or clearing specific bits, which does not happen when ORing with zero.


Common Pitfalls:
Confusing immediate with direct addressing. Without the #, ORL A, 00H would OR with RAM location 00H (R0 in Bank 0), yielding an unknown result unless that memory value is specified.


Final Answer:
2B H

More Questions from The 8051 Microcontroller

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion