Introduction
Author: Mihai Ricanu, Microchip Technology Inc. |
The Analog Peripheral Manager (APM) allows analog modules to be periodically turned on and off, without core interaction, using dedicated timers internal to the APM module. The APM allows the users to set custom time intervals in which configured analog modules will periodically activate to perform a specified function before deactivating and returning to a low-power state after the programmed time has elapsed. This peripheral is ideal for low-power applications that use analog sensors that only need to be periodically measured, as opposed to sensors that must be continuously monitored. Therefore, it allows the users to optimize the total power consumption in applications by scheduling the operation of analog peripherals without waking up the CPU.
The focus of this technical brief is to familiarize the user with the application area, hardware and software requirements, as well as the MCC configuration of the APM. Three use cases are presented, which are code-generated implementations using the MPLAB® Code Configurator (MCC). The showcased code examples have been developed around the PIC18F56Q71 microcontroller, but apply also to other 8-bit PIC device families that have an Analog Peripheral Manager peripheral.
This document covers the following use cases:
- Light-sensing alarm using the
Analog Comparator, controlled by the APM module:
- Using the APM to periodically enable and disable the Comparator peripheral to measure an analog signal and trigger an alarm once the measured level reaches the threshold set by the user.
- Sine waveform generation with
variable frequency, using ADC and DAC, controlled by the APM module:
- Using the APM to periodically enable and disable the ADC and DAC peripherals to output a sinusoidal waveform with variable frequency controlled by the value measured from a potentiometer.
- Triangle waveform generation with
variable amplitude, using FVR, ADC and DAC, controlled by the APM module:
- Using the APM to periodically enable and disable the FVR, ADC and DAC peripherals to output a triangle waveform with variable amplitude controlled by the value measured from a potentiometer.
Each of the use cases described in this technical brief has a corresponding web page on the Microchip MPLAB Discover web site, providing a comprehensive description of the hardware and software requirements for the demonstration of that use case. Links to the necessary code examples and complete configuration instructions are also provided.