Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AFEC Temperature Sensor Example

Purpose

The example demonstrates how to use the temperature sensor feature inside the microcontroller. The RAW data of temperature sampled by AFEC is taken by XDMAC and converted to temperature value ,which is output to terminal console. Three columns will be output to console, first column is AFEC channel,for temperature sensor on SAMV71/SAME70,it's channel 11, the second column is RAW data sampled, the third column is converted temperature value.

Requirements

This example can be used on SAMV71-Xplained-Ultra/SAME70-Xplained-Pro board.

Description

The example is aimed to demonstrate the temperature sensor feature inside the device and get temperature by XDMAC. To use this feature, the temperature sensor should be automatically turned on by RTC event. The channel 11 is connected to the sensor by default. If set RTCT = 1, TRGEN is disabled and all channels are disabled (AFE_CHSR = 0), then only channel 11 is converted at a rate of 1 conversion per second.

The temperature sensor provides an output voltage (VT) that is proportional to absolute temperature (PTAT). The relationship between measured voltage and actual temperature could be found in Electrical Characteristics part of the datasheet.

Usage

  1. Build the program and download it into the evaluation board.
  2. On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft Windows) with these settings:
    • 115200 bauds
    • 8 bits of data
    • No parity
    • 1 stop bit
    • No flow control
  3. In the terminal window, the following text should appear (values depend on the board and the chip used):
    -- AFEC Temperature Sensor xxx --
    -- xxxxxx-xx
    -- Compiled: xxx xx xxxx xx:xx:xx --
  4. The application will output current Celsius temperature on the terminal.