| Author: Marius Nicolae, Microchip Technology Inc. |
The tinyAVR® 0-series, tinyAVR 1-series and megaAVR® 0-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.
TCB will be configured in this mode and will generate a PWM signal with a 50% duty cycle for a 1-second period. A GPIO pin will be used as an output to showcase the signal.
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 input. An interrupt will be generated if the time-out (period from edge-to-edge) expires.
TCB will be configured to generate a periodic interrupt, even when the AVR® microcontroller is in Standby Sleep mode.