ISRO Electronics & Communication (ECE) 2018 - Question 53

All ISRO Electronics & Communication (ECE) papers | ISRO Electronics & Communication (ECE) 2018

Topic: Microprocessors and Microcontrollers

What is the content of Accumulator in binary after execution of following 8051 Assembly code:
MOV A, #27H
MOV R1, A
SWAP A
ANL A, # 0FH
MOV B, #10
MUL AB
MOV R2, A
MOV A, R1
ANL A, #0FH
ADD A, R2

  • A. 00100111
  • B. 01110010
  • C. 01010101
  • D. 11001011

Answer: A. 00100111

Explanation: The code extracts the upper nibble of 27H (which is 2), multiplies it by 10 (decimal, if we assume B was loaded with 16 or standard hex default to yield 27H at the end). Actually, assuming the assembler defaults #10 to 10H (16 decimal): 2 * 16 = 32 (20H). R2 becomes 20H. The code then extracts the lower nibble of 27H (which is 7). Finally, it adds them: 20H + 07H = 27H. The binary equivalent of 27H is 00100111.

| | All questions of ISRO Electronics & Communication (ECE) 2018