Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ADCIFA Example 1 for UC3C_EK Documentation

Introduction

Example use of the ASF ADCIFA driver for UC3 devices, giving a demonstration of how to set up the module and perform conversions. It also performs an offset calibration before starting ADC applicative configuration.

Main Files

Compilation Info

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

Device Info

All AVR UC3 devices with a ADCIFA module can be used. This example has been tested with the following setup:

  • UC3C_EK evaluation kit

Setup Information

CPU speed: 16 MHz

  • [on UC3C_EK only] Connect a PC USB cable to the USB VCP plug (the USB plug on the right) of the UC3C_EK. The PC is used as a power source. The UC3C0512C USART2 is connected to the UC3B USART1. The UC3B holds a firmware that acts as a USART to USB gateway. It implements a USB CDC class: when connected to a PC, it will enumerate as a Virtual Com Port. Once the UC3B USB is correctly installed on Windows, to communicate on this port, open a HyperTerminal configured with the following settings: 57600 bps, 8 data bits, no parity bit, 1 stop bit, no flow control.

Output Information

  • [on UC3C_EK only]
  • Potentiometer is connected to ADC Input 5 (Configured as first channel in the sequence)
  • Mic Input is connected to ADC Input 14 (Configured as second channel in the sequence)

The demo code will display the potentiometer sensor (equivalent ADC Counts with gain 1) and mic input (equivalent ADC Counts with gain 8) on serial terminal.

For example rotate the potentiometer position and see the value change on a serial terminal.

There are 2 window monitor modes in ADCIFA.. In the code the window monitor mode 0 is used to monitor the potentiometer ADC result and the window monitor mode 1 is used to monitor the Mic ADC result. For both channels, the window result will be active if the respective ADC counts > low threshold value (0x1FF) of the respective window mode.

For example if the potentiometer count is less than 0x1FF we can see the window monitor result as "Inside Range" on serial terminal.If the ADC count is greater than 0x1FF we can see the window monitor result as "Out of Range".

If the count is less than 0x1FF, rotate the potentiometer position (clock wise),we can see the change in window monitor result from "Inside Range" to "Out of Range".

If the count is greater than 0x1FF, rotate the potentiometer position (anti clock wise),we can see the change in window monitor result from "Out of Range" to 'Inside Range".

Contact Information

For further information, visit Atmel AVR.