Question
Download Solution PDFWhat will be the content in register A, after execution of following code in 8051? (Suffix H denotes hexadecimal number)
CLR A
MOV RO, #77H
CPL A
XRL A, RO
MOV A, RO
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFExplanation:
Step-by-Step Execution:
1. CLR A:
The "CLR A" instruction clears the accumulator register A, setting its content to 00H. After this instruction, the value of register A becomes:
A = 00H
2. MOV R0, #77H:
The "MOV R0, #77H" instruction moves the immediate value 77H into register R0. Now, the value of register R0 becomes:
R0 = 77H
3. CPL A:
The "CPL A" instruction complements the contents of register A bit by bit. Since A = 00H (all bits are 0), complementing it will result in FFH (all bits are 1). After this instruction, the value of register A becomes:
A = FFH
4. XRL A, R0:
The "XRL A, R0" instruction performs a bitwise XOR operation between the contents of register A and register R0. XOR operation rules are as follows:
- 0 XOR 0 = 0
- 0 XOR 1 = 1
- 1 XOR 0 = 1
- 1 XOR 1 = 0
Currently:
A = FFH (binary: 11111111)
R0 = 77H (binary: 01110111)
Performing XOR, we get:
11111111 (A)
01110111 (R0)
Result: 10001000 (binary) = 88H
After this instruction, the value of register A becomes:
A = 88H
5. MOV A, R0:
The "MOV A, R0" instruction moves the contents of register R0 into register A. Now, the value of register A becomes:
A = 77H
The correct answer is: Option 3: 77H
Last updated on May 30, 2025
-> The ISRO Technical Assistant recruitment 2025 notification has been released at the official website.
-> Candidates can apply for ISRO recruitment 2025 for Technical Assistant from June 4 to 18.
-> A total of 83 vacancies have been announced for the post of Technical Assistant.
-> The Selection process consists of a written test and a Skill test.
-> Candidates can also practice through ISRO Technical Assistant Electrical Test Series, ISRO Technical Assistant Electronics Test Series, and ISRO Technical Assistant Mechanical Test Series to improve their preparation and increase the chance of selection.