Introduction
Author: Ioan Pop, Microchip Technology Inc. |
The Analog-to-Digital Converter with Computation (ADCC) peripheral converts an analog voltage value into a 10-bit numerical value and offers different computational actions that can be performed on the result such as averaging or low-pass filtering. The code examples in this technical brief also apply to other PIC18 families of devices that feature a 12-bit ADCC.
For each use case, there are two different implementations which have the same functionalities: one code generated with MPLAB® Code Configurator (MCC) and one bare metal code. The MCC-generated code offers hardware abstraction layers that ease the use of the code across different devices from the same family. The bare metal code is easier to follow, allowing a fast ramp-up on the use case associated code.
This technical brief describes the application area, the modes of operation and the hardware and software requirements of the Analog-to-Digital Converter with Computation. It covers the following use cases:
- ADCC
Single Conversion:
This example shows how to configure the ADCC to perform a single conversion.
- ADCC
Temperature Measurement:
This example shows how to configure the ADCC to read the temperature sensor and provide a value in Celsius and Fahrenheit.
- ADCC
Low-pass Filtering of a Conversion:
This example shows how to configure the ADCC to perform a conversion in the low-pass filter mode.
- ADCC
Spike Detection:
This example shows how to configure the ADCC to trigger an interrupt when a voltage spike is detected.