Introduction
Author: Cristian Pop, Microchip Technology Inc. |
Microchip tinyAVR® 0- and 1-series, megaAVR® 0-series and AVR® Dx devices feature an Analog Comparator (AC) with flexible input selection, selectable hysteresis and configurable output (interrupts on rising/falling or both edges, event generation, and output inversion).
This technical brief explains the AC concepts and its implementation in tinyAVR® 0- and 1-series, megaAVR® 0-series and AVR® Dx devices with the following use cases:
- Level
Crossing Detector:
This example shows how to use the AC to detect when a critical value of an analog signal is reached (for example, the battery level).
- Preventing
False Spike Detection:
This example demonstrates how to use the hysteresis feature to minimize the number of false transitions in a noisy environment.
- Analog Signal
Pulse Duration/Frequency Measurements:
The example describes how to use the AC together with a timer to measure the pulse duration and/or the period of analog signals with minimal intervention of the AVR core.