AVR Microcontroller Questions and Answers – I/O Port Programming and Addressing Modes

This set of AVR Micro-controller Multiple Choice Questions & Answers (MCQs) focuses on “I/O Port Programming and Addressing Modes”.

1. In AVR, which registers are there for the I/O programming of ports?
a) PORT
b) PIN
c) DDR
d) All of the mentioned
View Answer

Answer: d
Explanation: For I/O programming of the ports in AVR microcontrollers, there are basically three main registers. They are PORT, PIN, DDR, so all of the mentioned is the right option.

2. The data will not go from the port registers to the pin unless:
a) DDR register of that port is set to 0
b) PORT register of that port is set to 1
c) DDR register of that port is set to 1
d) PORT register of that port is set to 0
View Answer

Answer: c
Explanation: The data will not go from the port registers to the pin unless the DDR register of that port is set to 1 because by doing this we make that port an output port after which data can be taken from the PORT registers to the pin.

3. On reset DDR registers of all ports are set to:
a) 0
b) 1
c) None of the mentioned
d) 0 & 1
View Answer

Answer: a
Explanation: On reset, the DDR registers of all the ports are set to 0 which means that the by default all ports are set as input ports.
advertisement
advertisement

4. Which of the following statements are correct?
a) PIN register of a port is used to bring data into CPU from pins
b) PORT register is used to send data out to pins
c) DDR register is used to control the direction of a port
d) All of the mentioned
View Answer

Answer: d
Explanation: There are three registers that are related to a port. They are PIN, PORT, DDR. PIN register is used to bring data into CPU from pins, PORT register is used to send data to pins and DDR register is used to control the direction of the data transfer. So all are the right options.

5. In the AVR family, all I/O ports have 8 pins?
a) true
b) false
c) none of the mentioned
d) can’t be determined
View Answer

Answer: b
Explanation: In the AVR family, all I/O ports don’t have 8 pins. Number of I/O pins depends on the total number of pins of the controller. Eg. ATtinyxx is an 8 pin controller and it has 6 I/O pins.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which of the following is not a single bit instruction in AVR?
a) SBI
b) PORT
c) CBI
d) All of the mentioned
View Answer

Answer: b
Explanation: PORT is not an instruction. It is the name of a register in AVR.

7. Which of the following is correct about the SBIS instruction?
a) it is used to monitor status of bit in I/O register
b) it is a byte oriented instruction
c) It is a 4 byte instruction
d) all of the mentioned
View Answer

Answer: a
Explanation: SBIS (Skip if Bit in I/O register Set) is used to check status of bit in I/O register. If the bit mentioned in the instruction is SET or HIGH then the controller will skip the immediate next instruction.
advertisement

8. Instruction CBI PORTB,1 means
a) clearing the PORTB register
b) clearing the first bit of the PORTB register
c) setting the PORTB register
d) setting the first bit of the PORTB register
View Answer

Answer: b
Explanation: CBI PORTB, 1 means to clear the first bit of the PORTB register. It is a bit oriented instruction.

9. Which of the following instruction can be used to toggle a bit of the PORT?
a) SBI
b) CBI
c) SBI & CBI
d) None of the mentioned
View Answer

Answer: c
Explanation: If SBI and CBI are used together, then they can be used to toggle a bit of a port successfully.
advertisement

10. What is the main function of the SBIC instruction?
a) it is used to clear a particular bit of a port
b) it is used to jump unconditionally
c) it is used to skip the instruction if a particular bit of a port is zero
d) none of the mentioned
View Answer

Answer: c
Explanation: SBIC (Skip if Bit in I/O register Clear) is used to check status of bit in I/O register. If the bit mentioned in the instruction is CLEAR or LOW then the controller will skip the immediate next instruction.

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.