Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ADC Scan example for XMEGA-A3BU Xplain Documentation

Introduction

This simple example shows how to use the new scan feature found in the XMEGA-...U devices.

Main files:

ADC driver API

The ADC driver API can be found here.

Device Info

All AVR XMEGA U devices with an ADC can be used or devices that have the scan register on ADCA channel 0.

Description of the example

ADC A is configured for signed, 12-bit conversions using the internal 1 V voltage reference. The conversions are configured to be triggered from the event system. Channel 0 of the ADC is configured for differential measurement of all ADCA pins (PA0-PA7) with internal ground.

An ADC interrupt callback function is used to handle the conversion results, each result is stored into an array at the position corresponding to the pin number, e.g. PA0 result is stored in adc_scan_results[0].

Compilation Info

This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.