Purpose
This example demonstrates how to use the ACIFC module and its interrupt to get a comparison result from a pair of inputs.
Requirements
This example has been tested on the following evaluation kits:
- SAM4L EK
- SAM4L Xplained Pro
- SAM4L8 Xplained Pro
Description
This example demonstrates usage of the ACIFC module. The device pins PA06 and PA07 are selected as inputs. The connection can be as follows:
For SAM4L EK
- PA06(J100.2) – ADC SENSOR VBAT(J105.1)
- PA07(J4.4) – VCC(J4.10)
Or
- PA06(J100.2) – ADC SENSOR VBAT(J105.1)
- PA07(J4.4) – GND(J4.9)
For SAM4L/SAM4L8 Xplained Pro:
- PA06(EXT3/PIN9) – GND(EXT3/PIN19)
- PA07(EXT2/PIN3) – VCC(EXT2/PIN20)
Or
- PA06(EXT3/PIN9) – VCC(EXT3/PIN20)
- PA07(EXT2/PIN3) – GND(EXT2/PIN19)
Main Files
- acifc.c: Analog Comparator Interface Controller driver
- acifc.h: Analog Comparator Interface Controller driver header file
- acifc_example.c: Analog Comparator Interface Controller example application
Compilation Information
This software is written for GNU GCC and IAR Embedded Workbench® for Atmel®. Other compilers may or may not work.
Usage
- Build the program and download it into the evaluation board.
- On the computer, open, and configure a terminal application (e.g., HyperTerminal on Microsoft® Windows®) with these settings:
- 115200 baud
- 8 bits of data
- No parity
- 1 stop bit
- No flow control
- Start the application.
- In the terminal window, the following text should appear:
* -- ACIFC IRQ Example xxx --
* -- xxxxxx-xx
* -- Compiled: xxx xx xxxx xx:xx:xx --
- The application will output a different message if the voltage on pin. PA06 is lower or higher than the voltage on pin PA07 :
-
ISR- Voltage Comparison Result: ACAP0 > ACAN0
or -
ISR- Voltage Comparison Result: ACAP0 < ACAN0