Introduction
Author: Marius Nicolae, Microchip Technology Inc. |
The tinyAVR® 0- and 1-series, megaAVR® 0-series, and AVR® DA-series of microcontrollers are equipped with powerful timers that enable them to cover a wide area of applications. Timer/Counter type B (TCB) offers a variety of features and operation modes, from periodic interrupts to 8-bit PWM or time-out. The various operation modes of the TCB can be used in correlation with the event system. The scope of this technical brief is to show the configuration of three operation modes.
- Using TCB in
8-bit PWM mode:
TCB will be configured in this mode and will generate a PWM signal with a 50% duty cycle with a period of one second. A GPIO pin will be used as an output to showcase the signal.
- Using TCB in
Time-Out Check mode:
TCB will be configured in this mode and will be used to measure the signal time (edge-to-edge) generated by a GPIO pin configured as an input. An interrupt will be generated if the time-out (the period from edge-to-edge) expires.
- Using TCB in
sleep mode:
TCB will be configured to generate a periodic interrupt, even when the AVR® microcontroller is in Standby sleep mode.