Solved Examples · Example 5
Q.Write a program to add two 8-bit number, and store it in R5. The numbers are 0F1H and 0DH
Karnataka PUCTextbookLongImportance★★★★★est
26% · 30/115 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
Load into A, add , copy A to R5. , so R5 holds .
This Karnataka 2nd PUC Electronics microcontroller example uses the 8051 instruction, whose form is . The destination of an ADD is always the accumulator A, so both operands are brought through A before the result is moved to the required register R5.
8051 program:
MOV A, #0F1H ; load F1H (241) into the accumulator
ADD A, #0DH ; add 0DH (13); now A = A + 0DH
MOV R5, A ; store the sum in register R5
NOP
END
Working out the addition:
1111 0001 (0F1H = 241)
+ 0000 1101 (0DH = 13)
-----------
1111 1110 (0FEH = 254)
``` …
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.