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

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

1. Which of the following is correct about BRNE instruction in avr microcontrollers?
a) it is used to compare two registers
b) it is used to compare two values
c) it is used to check the zero flag
d) it is used to jump to the given mentioned label when the zero flag accounts to 0
View Answer

Answer: d
Explanation: BRNE label instruction is used to jump to that particular address denoted by label if condition (Z=0) is true or satisfied. If the condition is not satisfied then it will execute the next immediate instruction.

2. How many times is this loop going to get executed?

     LDI R20, 10
now: LDI R21, 70
     DEC R21
     BRNE now
     OUT PORTB, R20

a) 10
b) 70
c) 700
d) none of the mentioned
View Answer

Answer: b
Explanation: As the R21 register is loaded with 70, so to make it zero it needs to be decremented 70 times then only the OUT instruction will be executed so this loop repeats 70 times.
advertisement
advertisement

3. Which of the below mentioned are not the conditional jumps?
a) BRLO
b) BRMI
c) BRVC
d) None of the mentioned
View Answer

Answer: d
Explanation: BRLO is used to branch if C=1, BRMI is used when N=1 and BRVC are used when V=0, so all are the conditional jumps.

4. What is the relation between the target and the relative address?
a) target address= PC address + relative address
b) target address= relation address*2
c) relative address= PC address + target address
d) none of the mentioned
View Answer

Answer: a
Explanation: Target address can be calculated by calculating the sum of the address of the program counter and the relative address.

5. In the JMP instruction, how many bits are there for determining the target address?
a) 16
b) 32
c) 22
d) 10
View Answer

Answer: c
Explanation: In the JMP instruction of 4 bytes space, 22 bits are there for determining the target address and the other 10 are for the op code verification.

6. Which of the following statements are correct?
a) relative address of RJMP instruction varies from 000-fffH
b) target address of JMP instruction varies from 000000-3fffffH
c) IJMP instruction jumps to that address that points to by the Z register
d) all of the mentioned
View Answer

Answer: d
Explanation: The relative address of the RJMP instruction varies from 000-fffH. The target address of the JMP instruction varies from 000000-3fffffH. IJMP instruction is used to jump at that particular address pointed to by the Z register. So all are the correct statements.

7. Which of the following is used to represent the last RAM address?
a) MEM
b) LASTRAM
c) RAMEND
d) None of the mentioned
View Answer

Answer: c
Explanation: RAMEND is a micro used to represent the last RAM address. In AVR, Stack Pointer is initialized on top of the stack i.e. last address of RAM.
advertisement

8. Which of the following statements are correct about the RCALL instruction?
a) it is a 2 byte instruction
b) it is a 4 byte instruction
c) it is a 16 byte instruction
d) none of the mentioned
View Answer

Answer: a
Explanation: RCALL instruction is used to go to the target address in the memory from -2048 to 2047.
advertisement

9. On power on SP points to the address?
a) ffffH
b) fffH
c) 00h
d) all of the mentioned
View Answer

Answer: c
Explanation: On power on SP register points to the 00H address.

10. Which of the following statements is true?
a) CALL instruction is used to transfer control anywhere in the 4M memory space
b) PUSH instruction is used to take out the value from the stack into some register
c) POP instruction is used to jump to any location
d) RCALL is a 4 byte instruction
View Answer

Answer: a
Explanation: CALL instruction is used to transfer control anywhere in the 4M memory space available in the AVR.

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.