8051 Microcontroller Questions and Answers – Jump, Loop and Call Instructions

This set of 8051 Micro-controller Multiple Choice Questions & Answers (MCQs) focuses on “Jump, Loop and Call Instructions”.

1. “DJNZ R0, label” is ________ byte instruction.
a) 2
b) 3
c) 1
d) Can’t be determined
View Answer

Answer: a
Explanation: DJNZ is 2-byte instruction. This means jump can be of -128 to +127 locations with respect to PC. Here -128 means upward or backward jump and +127 means downward or forward jump.

2. JZ, JNZ, instructions checked content of _______ register.
a) DPTR
b) B
c) A
d) PSW
View Answer

Answer: c
Explanation: JZ and JNZ instructions checked the content of A register and if condition was satisfied or true then jump to target address.

3. Calculate the jump code for again and here if code starts at 0000H

MOV R1,#0
MOV A,#0
MOV R0,#25H
AGAIN:ADD A,#0ECH
JNC HERE
HERE: INC R1
DJNZ R0,AGAIN 
MOV R0,A
END

a) F3,02
b) F9,01
c) E9,01
d) E3,02
View Answer

Answer: c
Explanation: Loop address is calculated by subtracting destination address and the address next to the source address.
So here if we start with 0000H
then source address is 0008H and the destination address is 0004H
So loop address is 04-0A=E9

4. When the call instruction is executed the topmost element of stack comes out to be
a) the address where stack pointer starts
b) the address next to the call instruction
c) address of the call instruction
d) next address of the stack pointer
View Answer

Answer: b
Explanation: The topmost element of the stack is the address of the instruction next to the call instruction so that when RET is executed then PC is filled with that address and so the pointer moves to the main program and continue with its routine task.
advertisement
advertisement

5. LCALL instruction takes
a) 2 bytes
b) 4 bytes
c) 3 bytes
d) 1 byte
View Answer

Answer: c
Explanation: LCALL instruction moves the pointer to a 16 bit address so it is a 3 byte instruction.

6. Are PUSH and POP instructions are a type of CALL instructions?
a) yes
b) no
c) none of the mentioned
d) cant be determined
View Answer

Answer: b
Explanation: PUSH and POP instructions are not CALL instructions because in POP and PUSH instructions the pointer does not move to any location specified by its address which is the fundamental of CALL instruction, so it is not a type of CALL instruction.
advertisement

7. What is the time taken by one machine cycle if crystal frequency is 20MHz?
a) 1.085 micro seconds
b) 0.60 micro seconds
c) 0.75 micro seconds
d) 1 micro seconds
View Answer

Answer: b
Explanation: Time taken by one machine cycle is calculated by the inverse of a (crystal frequency) /12

8. Find the number of times the following loop will be executed

MOV R6,#200
BACK:MOV R5,#100
HERE:DJNZ R5, HERE
DJNZ R6,BACK
END
advertisement

a) 100
b) 200
c) 20000
d) 2000
View Answer

Answer: c
Explanation: It will be executed 200*100 times.

9. What is the meaning of the instruction MOV A,05H?
a) data 05H is stored in the accumulator
b) fifth bit of accumulator is set to one
c) address 05H is stored in the accumulator
d) none of the mentioned
View Answer

Answer: c
Explanation: If we need to store the address in the accumulator, then directly the address is moved to it unlikely of using # used for storing data in any register.

10. Do the two instructions mean the same?

1) BACK:  DEC R0            
          JZ BACK
2) BACK:  DJNZ RO, BACK

a) yes
b) no
c) cant be determined
d) yes and the second one is preferred
View Answer

Answer: b
Explanation: In the first statement, when the decrements approach zero then the jump moves back and in the second statement, when the result after decrements is not zero, then it jumps back.

Sanfoundry Global Education & Learning Series – Microcontroller.

To practice all areas of Microcontroller, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.