Analog-to-Digital Converter with Computation

The Analog-to-Digital Converter (ADC), with computation module (ADCC), in Microchip’s latest family of 8-bit MCUs, has a built-in computational feature that provides post-processing functions such as oversampling, averaging, and low-pass filtering.

adcc(1).png

The analog input channel sources are multiplexed into a single sample and hold circuit. The output of the sample and hold circuit is connected to the converter, which generates a binary representation of the analog input. When the ADC is operating with computational features, the conversion result will be passed onto the computational feature block for post-processing. The post-processing result is then evaluated using error calculation and threshold comparison.

Channel Selection Source

The ADCC Channel Selection (ADPCH) register determines which channel is connected to the sample and hold circuit. Channel selection sources are not limited to external analog input sources but can also be an output of a peripheral or an internal reference voltage.

Voltage Reference Source

The voltage reference sets the input voltage range of the ADC. It can be an external source from the VREF+/- pins, VDD , FVR, and VSS.

Conversion Clock Source

The conversion clock has multiple sources, either from the main oscillator, which is divided into multiples of two (i.e., 2, 4, or 128) or from the dedicated internal resistance-capacitance (RC) clock.

Auto-Conversion Trigger Source

The auto-conversion trigger allows the module to schedule acquisition and conversion sequences without software intervention. When a rising edge of the selected source occurs, the ADC Conversion Status (ADGO) bit is set. The sources for the auto-conversion trigger can be found on the device data sheet for the device you are using. In an application, these auto-conversion trigger sources can be used to set the sampling period of the ADC.

Operational Modes

Below are the various modes available. Many of the descriptions include an image that visually describes the mode's operation along with an MPLAB® Code Configurator screenshot indicating how the mode is easily set up. After each mode is completed a Threshold Comparison is performed.

Basic Mode

The Basic mode of the ADCC mimics the legacy ADC operation. With the auto-trigger feature of the module, input sampling can be easily triggered in the software or by other peripherals and external sources. The result of the conversion can be compared to a threshold set point which may trigger the Analog-to-Digital Converter Interrupt Flag.

Accumulate Mode

In the Accumulate mode, the digital representation of the analog input signal in the 10-bit/12-bit register ADC Result High/Low(ADRESH) / (ADRESL) register is accumulated to the 16-bit ADC Accumulator Register (ADACC) register. With each sample, the ADC Conversion Counter (ADCNT) register is incremented, indicating the number of samples accumulated. The accumulated value can be right shifted up to six times by changing the value of the ADC Accumulate Calculation Right Shift Select (ADCRS) bits of the ADC Control Register 2 (ADCON2) register. This means that the accumulated value is effectively divided by a factor of two (2ADCRS). The result of the shifted accumulated value is stored in the ADC Filter (ADFLTR) register.

accumulate.png

Averaging Mode

The Average mode is like an accumulate mode wherein the ADACC accumulates the data sample and the ADCNT increments with each sample, except that the number of samples being accumulated in this mode is up to the value set in the A/D Repeat Setting (ADRPT) register. When the ADCNT is equal to ADRPT, the value stored in the ADFLTR becomes the average value of the input signal. This mode can be used when a defined time interval is needed for each sample.

average.png

Burst Average Mode

Like averaging mode, the Burst Average mode averages the input signal except that the sampling is repeated quickly after a single trigger. This means that in a single conversion, all the data samples are accumulated up to the set ADRPT and when the ADCNT matches the set ADPRT value, the average value of the input signal is attained.

burst.png

Low-Pass Filter Mode

The Low-pass Filter mode acts similarly to the Average mode in how it handles samples (accumulates samples until ADCNT value is greater than or equal to ADRPT, then triggers threshold comparison), but instead of a simple average, it performs a lowpass filter operation on all of the samples, reducing the effect of high-frequency noise on the average, then performs a threshold comparison on the results. In this mode, the ADCRS bits determine the cut-off frequency of the low-pass filter.

With each trigger, the ADC conversion result is sent through a filter. When ADRPT samples have occurred, a threshold test is performed. Every trigger after that the ADC conversion result is sent through the filter and another threshold test is performed.

lowpass.png

ADCC Output Actions

Threshold Comparison

The post-processing result of the ADCC module can be compared to the threshold value set in the ADC Error Calculation Mode Select bits (ADCALC) of the ADC Threshold (ADCON3) register. The calculated result is stored in the ADC Calculation Error (ADERR) register, which can be compared to the selected upper or lower threshold. These two threshold values can be set by changing the ADC Upper Threshold (ADUTH) registers and the ADC Lower Threshold (ADLTH) registers. A result of true, based on the comparison, will trigger an interrupt.

Continuous Mode Retrigger

Enabling the Continuous mode allows an automatic sampling retrigger after the threshold has been tested. In this mode, the ADGO of the ADC Control 0 (ADCON0) register remains set until the threshold conditions are met according to the selected Threshold Interrupt Mode Select bits (ADTMD) and the A/D Stop On Interrupt bit (ADSOI) of the ADCON3.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.