Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ADC Internal temperature sensor example for XMEGA-A3BU Xplained Documentation

Introduction

This simple example shows how to use the Analog to Digital Converter (ADC) for temperature measurement with the internal sensor.

Main files:

ADC driver API

The ADC driver API can be found here.

Device Info

All AVR XMEGA devices with an ADC can be used.

Description of the example

ADC A is configured for unsigned, 12-bit conversions using the VCC as voltage reference. The conversions are configured for manual triggering. Channel 0 of the ADC is configured for single-ended measurements from the internal temperature sensor.

An ADC interrupt callback function is used to handle the conversion results, from which the current temperature, in Celsius, is computed. The computation utilizes a linearization of the temperature data to calculate temperature in Celsius.

The computed temperature is stored in the global variable last_temperature, which is printed to the display, and can be watched during debugging.

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.