Exercise Problems · Q2
Q.Write the instructions to add the values 16H and CDH, place the result in register R2.
Karnataka PUCTextbookNumericImportance★★★★★est
7% · 8/115 Questions
✓ Free question
[!TLDR]
Add 16H and 0CDH in the accumulator and copy the result E3H into R2.
Concept. Addition uses the accumulator; the result can then be moved to any register. In 8051 assembly a hexadecimal constant that begins with a letter (A-F) must be written with a leading 0, so CDH is coded as #0CDH.
Program:
MOV A, #16H ; A = 16H
ADD A, #0CDH ; A = A + 0CDH
MOV R2, A ; R2 = A
Working: 16H = 22 and CDH = 205, so the sum is 227 decimal = E3H, with no carry out of bit 7 (CY = 0).
[!ANSWER]
R2 = E3H (227 decimal), CY = 0.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.