Microchip® Advanced Software Framework

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

Purpose

The adc_temp_sensor example demonstrates how to use the temperature sensor feature inside the microcontroller.

Requirements

This example can be used on any SAM3/4 boards.

Temperature sensor output range is from 0 to 3300 mv, hence ADVREF must be set to 3300 mv in order to provide reliable temperature information. Please refer to the board schematics for ADVREF jumper configuration.

Note
For SAM4CMP-DB and SAM4CMS-DB (Rev B), the ADVREF is not connected to 3300mv by default, so need to solder DNP component to get this example work correctly.

Description

The adc_temp_sensor is aimed to demonstrate the temperature sensor feature inside the device. To use this feature, the temperature sensor should be turned on by setting TSON bit in ADC_ACR. The channel 15 is connected to the sensor by default. With PDC support, the Interrupt Handler of ADC is designed to handle RXBUFF interrupt.

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):
    -- ADC Temperature Sensor xxx --
    -- xxxxxx-xx
    -- Compiled: xxx xx xxxx xx:xx:xx --
  4. The application will output current Celsius temperature on the terminal, and users can set temperature offset by a menu.