AVR Microcontroller Questions and Answers – Timer Programming

This set of AVR Micro-controller Multiple Choice Questions & Answers (MCQs) focuses on “Timer Programming”.

1. In AVR, which of the following registers are not used for programming timers?
a) TCNT
b) TCON
c) TIFR
d) None of the mentioned
View Answer

Answer: b
Explanation: In the timer programming of an AVR microcontroller, mainly used registers are TCNTn that stores the values of the count. TCCRn that is used to assign the mode of operation of a timer and TIFR that stores the status of various flags of the timers. Two more registers are used they are OCRn and OCFn. They are used for comparison with the count register.

2. What is the use of the prescalar in the operation of the timer?
a) for fast calculations
b) for increasing the time delay given by the timer by decreasing its frequency of operation
c) for removing the concept the reloading of count
d) for easy counter operations
View Answer

Answer: b
Explanation: Prescalars are used in the operation of the timers because they generally increase the time delay generation by decreasing the frequency of its operation.

3. What modes are generally used in the operation of the timer0?
a) Normal mode
b) CTC mode
c) PWM mode
d) All of the mentioned
View Answer

Answer: d
Explanation: Modes of a timer are decided by the WGM00 and WGM01 bit of the TCCR0 register and for timer0 these modes are normal mode, CTC mode, pwm mode and the fast pwm mode.
advertisement
advertisement

4. Timer 0 can act as a counter ____________
a) if the CS02-CS00 are 110 or 111
b) if the FOC0 bit is set to 110
c) none of the mentioned
d) all of the mentioned
View Answer

Answer: a
Explanation: Timer0 can act as a counter if the CS02-CS00 bits are from 110-111.

5. Which of the timer can operate in the 16 bit condition?
a) timer0
b) timer1
c) timer2
d) all of the mentioned
View Answer

Answer: b
Explanation: Timer0 and Timer2 can operate in the 8 bit condition while only Timer 1 operates in the 16 bit condition.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which of the following will generate the maximum time delay?
a) f/2
b) f/4
c) f/16
d) f/32
View Answer

Answer: d
Explanation: f/32 has the lowest frequency as it is divided by the maximum value of the constant, so as time and frequency are inversely related to each other so this will generate the maximum amount of machine cycle which will as a result generate the greatest delay.

7. What is the difference in the operation of a normal and a CTC mode of a timer?
a) in CTC mode PWM is used
b) here serial timer is monitored
c) in CTC mode, timer counts up until contents of TCNT register becomes equal to the contents of OCR
d) none of the mentioned
View Answer

Answer: c
Explanation: In CTC mode, timer counts up until the contents of TCNT register becomes equal to the contents of OCR; then the timer will be cleared and the OCF0 flag will be set when the next clock occurs. In Normal mode, timer counts until max i.e. 0xFFH. When it rolls over from 0xFFH to 0x00H, it sets TOV(Timer Overflow).
advertisement

8. We can count the pulses on the positive or the negative edge triggered pulse of the clock?
a) true
b) false
c) can’t be determined
d) depends on the circumstances
View Answer

Answer: a
Explanation: A counter can count pulses on the positive or the negative edge of the clock.

9. Which pin is used for the input clock of the counter0?
a) PORTB.0
b) PORTB.1
c) PORTB.2
d) PORTB.3
View Answer

Answer: a
Explanation: In ATmega32/16, T0 is the alternative function of PORTB.0. T0 is Timer/Counter 0 External Clock Input.
advertisement

10. Which resource provides the clock pulse to AVR timers if CS02-00=6?
a) internal clock of the AVR
b) external clock of the AVR
c) none of the mentioned
d) all of the mentioned
View Answer

Answer: b
Explanation: The External clock is used for providing the pulse to the AVR timers if CS02-00=6.

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.