Introduction

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.

Note: In each example, GPIOs are used either for input (event system input signal), or for output (e.g. toggling a pin each time an interrupt occurs). The code examples were developed using the ATmega4809 Xplained Pro (ATMEGA4809-XPRO) development board, but are suitable for the entire tinyAVR 0-series, tinyAVR 1-series and megaAVR 0-series.