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.
This software was written for the GNU GCC for AVR32 and IAR Systems compiler for AVR UC3. Other compilers may or may not work.
All AVR UC3 devices with a ADCIFA module can be used. This example has been tested with the following setup:
CPU speed: 16 MHz
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".
For further information, visit Atmel AVR.