View detail for Atmel AT07899: SAM3S/4E /4S Analog Comparator Controller (ACC)

SMART ARM-based Microcontrollers
AT07899: SAM3S/4E/4S Analog Comparator
Controller (ACC) Driver
APPLICATION NOTE
Introduction
®
®
This driver for Atmel | SMART ARM -based microcontrollers provides an
interface for the configuration and management of the device's Analog
Comparator Controller functionality.
The Analog Comparator compares two voltages, and the result of this
comparison gives a compare output. The user application can select
whether to use a high-speed or a low-power option as well as selecting the
hysteresis level, edge detection, and polarity.
Devices from the following series can use this module:
•
Atmel | SMART SAM3S
•
Atmel | SMART SAM4E
•
Atmel | SMART SAM4S
The outline of this documentation is as follows:
•
Prerequisites
•
Module Overview
•
Special Considerations
•
Extra Information
•
Examples
•
API Overview
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
Table of Contents
Introduction......................................................................................................................1
1. Software License....................................................................................................... 4
2. Prerequisites..............................................................................................................5
3. Module Overview....................................................................................................... 6
4. Special Considerations.............................................................................................. 7
4.1.
4.2.
4.3.
4.4.
4.5.
Configuration Changes.................................................................................................................7
I/O Lines....................................................................................................................................... 7
Power Management..................................................................................................................... 7
Interrupt........................................................................................................................................ 7
Fault Output..................................................................................................................................7
5. Extra Information....................................................................................................... 8
6. Examples................................................................................................................... 9
7. API Overview........................................................................................................... 10
7.1.
7.2.
Macro Definitions........................................................................................................................10
7.1.1.
Hysteresis Levels.........................................................................................................10
Function Definitions....................................................................................................................10
7.2.1.
Function acc_disable().................................................................................................10
7.2.2.
Function acc_disable_interrupt()................................................................................. 10
7.2.3.
Function acc_enable()..................................................................................................11
7.2.4.
Function acc_enable_interrupt().................................................................................. 11
7.2.5.
Function acc_get_comparison_result()........................................................................ 11
7.2.6.
Function acc_get_interrupt_status().............................................................................11
7.2.7.
Function acc_get_writeprotect_status().......................................................................12
7.2.8.
Function acc_init()....................................................................................................... 12
7.2.9.
7.2.10.
7.2.11.
7.2.12.
Function acc_reset().................................................................................................... 14
Function acc_set_input()............................................................................................. 14
Function acc_set_output()........................................................................................... 15
Function acc_set_writeprotect()...................................................................................16
8. Extra Information for Analog Comparator Controller............................................... 17
8.1.
8.2.
8.3.
8.4.
Acronyms....................................................................................................................................17
Dependencies.............................................................................................................................17
Errata..........................................................................................................................................17
Module History............................................................................................................................17
9. Examples for Analog Comparator Controller........................................................... 18
9.1.
Quick Start Guide for the ACC driver......................................................................................... 18
9.1.1.
Use Cases................................................................................................................... 18
9.1.2.
ACC Basic Usage........................................................................................................ 18
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
2
9.1.3.
9.2.
Setup Steps................................................................................................................. 18
9.1.4.
Usage Steps................................................................................................................ 19
Analog Comparator Controller - Example Interrupt Event Generation....................................... 19
9.2.1.
Purpose....................................................................................................................... 19
9.2.2.
Requirements.............................................................................................................. 19
9.2.3.
Description...................................................................................................................19
9.2.4.
Main Files.................................................................................................................... 19
9.2.5.
Compilation Information...............................................................................................20
9.2.6.
Usage.......................................................................................................................... 20
10. Document Revision History..................................................................................... 21
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
3
1.
Software License
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of Atmel may not be used to endorse or promote products derived from this software without
specific prior written permission.
4. This software may only be redistributed and used in connection with an Atmel microcontroller product.
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY
DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
4
2.
Prerequisites
There are no prerequisites for this module.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
5
3.
Module Overview
The Analog Comparator Controller configures the Analog Comparator, and generates an interrupt
according to the user application's settings. The analog comparator embeds 8 to 1 multiplexers on both
its plus and minus inputs.
The Analog Comparator compares two voltages, and the result of this comparison gives a compare
output and an interrupt can be generated accordingly. The user application can select a high-speed or
low-power option, the hysteresis level, edge detection, and polarity.
The ACC can also generate a comparison event that can be used by the Pulse Width Modulation (PWM)
module.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
6
4.
Special Considerations
4.1.
Configuration Changes
As soon as the analog comparator settings are modified, the output of the analog comparator is masked
for the time that its output may be invalid. Depending on the user application the following function calls
may require the comparator output to be valid before continuing:
•
acc_enable()
•
acc_set_input()
•
acc_set_output()
The following code may be used to check if the comparator output is valid before continuing:
* while ((acc_get_interrupt_status(ACC) & ACC_ISR_MASK) == ACC_ISR_MASK) {
* }
4.2.
I/O Lines
The analog input pins (AD0-AD7 and DAC0-1) are multiplexed with general-purpose input/output (GPIO)
lines. The assignment of these pins to ACC module inputs is automatically done when the corresponding
input is assigned to the comparator's plus/minus inputs by the user application performing a write to the
module's Mode Register.
4.3.
Power Management
The ACC module is clocked through the Power Management Controller (PMC), thus the user application
must first configure the PMC, in order to enable the Analog Comparator Controller clock.
Note: The voltage regulator must be activated before the Analog Comparator module is used.
4.4.
Interrupt
The ACC module has an interrupt line connected to the Nested Vectored Interrupt Controller (NVIC).
Handling the ACC interrupt requires that the NVIC is configured before configuring the ACC.
4.5.
Fault Output
The ACC module has a FAULT output that is connected to the FAULT input of the PWM module. Refer to
"fault mode" and the implementation of the PWM in the device-specific datasheet.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
7
5.
Extra Information
For extra information, see Extra Information for Analog Comparator Controller. This includes:
•
Acronyms
•
Dependencies
•
Errata
•
Module History
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
8
6.
Examples
For a list of examples related to this driver, see Examples for Analog Comparator Controller.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
9
7.
API Overview
7.1.
Macro Definitions
7.1.1.
Hysteresis Levels
Refer to the "Analog Comparator Characteristics" table in the "Electrical Characteristics" chapter of the
device-specific datasheet.
7.1.1.1.
Macro ACC_ACR_HYST_0mv_max
#define ACC_ACR_HYST_0mv_max
7.1.1.2.
Macro ACC_ACR_HYST_50mv_max
#define ACC_ACR_HYST_50mv_max
7.1.1.3.
Macro ACC_ACR_HYST_90mv_max
#define ACC_ACR_HYST_90mv_max
7.2.
Function Definitions
7.2.1.
Function acc_disable()
Disable the ACC module.
void acc_disable(
Acc * p_acc)
Table 7-1 Parameters
7.2.2.
Data direction
Parameter name
Description
[in, out]
p_acc
Module hardware register base address pointer
Function acc_disable_interrupt()
Disable the ACC comparison edge interrupt.
void acc_disable_interrupt(
Acc * p_acc)
Table 7-2 Parameters
Data direction
Parameter name
Description
[out]
p_acc
Module hardware register base address pointer
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
10
7.2.3.
Function acc_enable()
Enable the ACC module.
void acc_enable(
Acc * p_acc)
Table 7-3 Parameters
7.2.4.
Data direction
Parameter name
Description
[in, out]
p_acc
Module hardware register base address pointer
Function acc_enable_interrupt()
Enable the ACC comparison edge interrupt.
void acc_enable_interrupt(
Acc * p_acc)
Table 7-4 Parameters
7.2.5.
Data direction
Parameter name
Description
[out]
p_acc
Module hardware register base address pointer
Function acc_get_comparison_result()
Get the ACC comparison result.
uint32_t acc_get_comparison_result(
Acc * p_acc)
Table 7-5 Parameters
Data direction
Parameter name
Description
[in]
p_acc
Module hardware register base address pointer
Returns
The ACC comparison result.
Table 7-6 Return Values
7.2.6.
Return value
Description
0
Comparator minus input is greater than its plus input (inn>inp)
1
Comparator plus input is greater than its minus input (inp>inn)
Function acc_get_interrupt_status()
Get the ACC comparison edge interrupt status.
uint32_t acc_get_interrupt_status(
Acc * p_acc)
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
11
Table 7-7 Parameters
Data direction
Parameter name
Description
[in]
p_acc
Module hardware register base address pointer
Returns
The ACC comparison edge interrupt status.
7.2.7.
Function acc_get_writeprotect_status()
Get the ACC register write-protection status.
uint32_t acc_get_writeprotect_status(
Acc * p_acc)
Table 7-8 Parameters
Data direction
Parameter name
Description
[in]
p_acc
Module hardware register base address pointer
Returns
The ACC register write-protection status.
Table 7-9 Return Values
7.2.8.
Return value
Description
0
No write-protection error
ACC_WPSR_WPROTERR
Write-protection error
Function acc_init()
Initialize the ACC module.
void acc_init(
Acc * p_acc,
uint32_t ul_select_plus,
uint32_t ul_select_minus,
uint32_t ul_edge_type,
uint32_t ul_invert)
Note: This function performs a software reset on the ACC module prior to its initialization.
Table 7-10 Parameters
Data direction
Parameter name
Description
[in, out]
p_acc
Module hardware register base address pointer
[in]
ul_select_plus
Selection for the plus comparator input (inp)
[in]
ul_select_minus
Selection for the minus comparator input (inn)
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
12
Data direction
Parameter name
Description
[in]
ul_edge_type
Comparison flag triggering mode
[in]
ul_invert
Invert the comparator output mode
Where the input parameter ul_select_plus is one of the following:
Parameter Value
Description
ACC_MR_SELPLUS_AD0
Select AD0 as the plus input
ACC_MR_SELPLUS_AD1
Select AD1 as the plus input
ACC_MR_SELPLUS_AD2
Select AD2 as the plus input
ACC_MR_SELPLUS_AD3
Select AD3 as the plus input
ACC_MR_SELPLUS_AD4
Select AD4 as the plus input
ACC_MR_SELPLUS_AD5
Select AD5 as the plus input
ACC_MR_SELPLUS_AD6
Select AD6 as the plus input
ACC_MR_SELPLUS_AD7
Select AD7 as the plus input
Where the input parameter ul_select_minus is one of the following:
Parameter Value
Description
ACC_MR_SELMINUS_TS
Select TS as the minus input
ACC_MR_SELMINUS_ADVREF
Select ADVREF as the minus input
ACC_MR_SELMINUS_DAC0
Select DAC0 as the minus input
ACC_MR_SELMINUS_DAC1
Select DAC1 as the minus input
ACC_MR_SELMINUS_AD0
Select AD0 as the minus input
ACC_MR_SELMINUS_AD1
Select AD1 as the minus input
ACC_MR_SELMINUS_AD2
Select AD2 as the minus input
ACC_MR_SELMINUS_AD3
Select AD3 as the minus input
Where the input parameter ul_edge_type is one of the following:
Parameter Value
Description
ACC_MR_EDGETYP_RISING
Rising edge of comparator output
ACC_MR_EDGETYP_FALLING
Falling edge of comparator output
ACC_MR_EDGETYP_ANY
Any edge of comparator output
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
13
Where the input parameter ul_invert is one of the following:
7.2.9.
Parameter Value
Description
ACC_MR_INV_DIS
Comparator output is directly processed
ACC_MR_INV_EN
Comparator output is inverted prior to being processed
Function acc_reset()
Software reset the ACC module.
void acc_reset(
Acc * p_acc)
Table 7-11 Parameters
7.2.10.
Data direction
Parameter name
Description
[out]
p_acc
Module hardware register base address pointer
Function acc_set_input()
Set the ACC comparator plus/minus input sources.
void acc_set_input(
Acc * p_acc,
uint32_t ul_select_minus,
uint32_t ul_select_plus)
Table 7-12 Parameters
Data direction
Parameter name
Description
[in, out]
p_acc
Module hardware register base address pointer
[in]
ul_select_minus
Selection for the minus comparator input (inn)
[in]
ul_select_plus
Selection for the plus comparator input (inp)
Where the input parameter ul_select_minus is one of the following:
Parameter Value
Description
ACC_MR_SELMINUS_TS
Select TS as the minus input
ACC_MR_SELMINUS_ADVREF
Select ADVREF as the minus input
ACC_MR_SELMINUS_DAC0
Select DAC0 as the minus input
ACC_MR_SELMINUS_DAC1
Select DAC1 as the minus input
ACC_MR_SELMINUS_AD0
Select AD0 as the minus input
ACC_MR_SELMINUS_AD1
Select AD1 as the minus input
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
14
Parameter Value
Description
ACC_MR_SELMINUS_AD2
Select AD2 as the minus input
ACC_MR_SELMINUS_AD3
Select AD3 as the minus input
Where the input parameter ul_select_plus is one of the following:
7.2.11.
Parameter Value
Description
ACC_MR_SELPLUS_AD0
Select AD0 as the plus input
ACC_MR_SELPLUS_AD1
Select AD1 as the plus input
ACC_MR_SELPLUS_AD2
Select AD2 as the plus input
ACC_MR_SELPLUS_AD3
Select AD3 as the plus input
ACC_MR_SELPLUS_AD4
Select AD4 as the plus input
ACC_MR_SELPLUS_AD5
Select AD5 as the plus input
ACC_MR_SELPLUS_AD6
Select AD6 as the plus input
ACC_MR_SELPLUS_AD7
Select AD7 as the plus input
Function acc_set_output()
Set the ACC output.
void acc_set_output(
Acc * p_acc,
uint32_t ul_invert,
uint32_t ul_fault_enable,
uint32_t ul_fault_source)
Table 7-13 Parameters
Data direction
Parameter name
Description
[in, out]
p_acc
Module hardware register base address pointer
[in]
ul_invert
Invert comparator output
[in]
ul_fault_enable
Fault enable
[in]
ul_fault_source
Selection of fault source
Where the input parameter ul_invert is one of the following:
Parameter Value
Description
ACC_MR_INV_DIS
Comparator output is directly processed
ACC_MR_INV_EN
Comparator output is inverted prior to being processed
Where the input parameter ul_fault_enable is one of the following:
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
15
Parameter Value
Description
ACC_MR_FE_DIS
The FAULT output is tied to 0
ACC_MR_FE_EN
The FAULT output is driven by ul_fault_source
Where the input parameter ul_fault_source is one of the following:
Parameter Value
Description
ACC_MR_SELFS_CF
The CF flag is used to drive the FAULT output
ACC_MR_SELFS_OUTPUT The output of the Analog Comparator flag is used to drive the FAULT
output
7.2.12.
Function acc_set_writeprotect()
Set the ACC register write-protection.
void acc_set_writeprotect(
Acc * p_acc,
uint32_t ul_enable)
Table 7-14 Parameters
Data direction
Parameter name
Description
[out]
p_acc
Module hardware register base address pointer
[in]
ul_enable
1 to enable, 0 to disable
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
16
8.
Extra Information for Analog Comparator Controller
8.1.
Acronyms
Below is a table listing the acronyms used in this module, along with their intended meanings.
8.2.
Acronym
Definition
AD
Analog to Digital
DAC
Digital to Analog Converter
GPIO
General Purpose Input Output
NVIC
Nested Vectored Interrupt Controller
PMC
Power Management Controller
PWM
Pulse Width Modulator
QSG
Quick Start Guide
Dependencies
This driver has the following dependencies:
•
8.3.
None
Errata
There are no errata related to this driver.
8.4.
Module History
An overview of the module history is presented in the table below, with details on the enhancements and
fixes made to the module since its first release. The current version of this corresponds to the newest
version in the table.
Changelog
Initial document release
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
17
9.
Examples for Analog Comparator Controller
This is a list of the available Quick Start guides (QSGs) and example applications for SAM3S/4E/4S
Analog Comparator Controller (ACC) Driver. QSGs are simple examples, with step-by-step instructions to
configure and use this driver in a selection of use cases. Note that a QSG can be compiled as a
standalone application or be added to the user application.
•
•
9.1.
Quick Start Guide for the ACC driver
Analog Comparator Controller - Example Interrupt Event Generation
Quick Start Guide for the ACC driver
This is the quick start guide for the SAM3S/4E/4S Analog Comparator Controller (ACC) Driver, with stepby-step instructions on how to configure and use the driver for a specific use case. The code examples
can be copied into e.g. the main application loop or any other function that will need to control the ACC
module.
9.1.1.
Use Cases
•
9.1.2.
ACC Basic Usage
ACC Basic Usage
This use case will demonstrate how to initialize the ACC module in interrupt mode.
9.1.3.
Setup Steps
9.1.3.1.
Prerequisites
This module requires the following service:
•
System Clock Management (sysclock)
9.1.3.2.
Setup Code
Add this to your main application C-file:
void ACC_Handler(void)
{
}
Add this to the main loop or a setup function:
pmc_enable_periph_clk(ID_ACC);
9.1.3.3.
Workflow
1.
Initialize the ACC module so that:
•
ADC channel 5 is connected to its positive input
•
DAC channel 0 is connected to its negative input
•
Generate an interrupt on either edge of the output
•
Disable the ACC module output inversion
acc_init(ACC, ACC_MR_SELPLUS_AD5, ACC_MR_SELMINUS_DAC0,
ACC_MR_EDGETYP_ANY, ACC_MR_INV_DIS);
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
18
2.
Enable the ACC module interrupt:
NVIC_EnableIRQ(ACC_IRQn);
acc_enable_interrupt(ACC);
9.1.4.
Usage Steps
9.1.4.1.
Usage Code
In the ACC_Handler() function, check if the output result is available by:
if ((ul_status & ACC_ISR_CE) == ACC_ISR_CE) {
}
In the ACC_Handler() function, check if ADC channel 5 is greater than DAC channel 0 by:
if (acc_get_comparison_result(ACC)) {
do_something_with_a_greater_result();
}
In the ACC_Handler() function, check if ADC channel 5 is less than DAC channel 0 by:
if (!acc_get_comparison_result(ACC)) {
do_something_with_a_lesser_result();
}
9.2.
Analog Comparator Controller - Example Interrupt Event Generation
9.2.1.
Purpose
This example demonstrates how to use the ACC driver to perform a voltage comparison on a pair of
inputs and generate an interrupt.
9.2.2.
Requirements
This example can be used on the following evaluation kits:
•
SAM4S EK
•
SAM4S EK2
9.2.3.
Description
The DAC0 and AD5 signals are selected as the inputs to the analog comparator. The user can change
the output voltage of DAC0 and also change the voltage on AD5 by adjusting VR1 on the evaluation kit.
The DAC0 output voltage can be adjusted between (1/6)*ADVREF and (5/6)*ADVREF in software, whilst
the input voltage on AD5 can vary between 0 and ADVREF.
A comparison interrupt event is generated when the input voltages are no longer equal.
9.2.4.
Main Files
•
•
•
acc.c: Analog Comparator Controller driver
acc.h: Analog Comparator Controller driver header file
acc_example.c: Analog Comparator Controller example application
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
19
9.2.5.
Compilation Information
®
®
This software is written for GNU GCC and IAR Embedded Workbench for Atmel . Other compilers may
or may not work.
9.2.6.
Usage
1.
2.
3.
4.
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:
-- ACC IRQ Example xxx --- xxxxxx-xx
-- Compiled: xxx xx xxxx xx:xx:xx ------
5.
6.
Menu Choices for this example-s: Set new DAC0 output voltage.-v: Get voltage on potentiometer.-m: Display this menu again.--
Enter a character on the terminal to select a menu option.
Change the voltage on AD5 by adjusting VR1 on the evaluation kit in order. To see what
comparison events occur.
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
20
10.
Document Revision History
Doc. Rev.
Date
Comments
42292B
07/2015
Updated title of application note and added list of supported devices
42292A
05/2014
Initial document release
Atmel AT07899: SAM3S/4E/4S Analog Comparator Controller (ACC) Driver [APPLICATION
NOTE]
Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
21
Atmel Corporation
©
1600 Technology Drive, San Jose, CA 95110 USA
T: (+1)(408) 441.0311
F: (+1)(408) 436.4200
|
www.atmel.com
2015 Atmel Corporation. / Rev.: Atmel-42292B-SAM3S/4E/4S-Analog-Comparator-Controller-ACC-Driver_AT07899_Application Note-07/2015
®
®
Atmel , Atmel logo and combinations thereof, Enabling Unlimited Possibilities , and others are registered trademarks or trademarks of Atmel Corporation in U.S. and
®
®
®
other countries. ARM , ARM Connected , and others are registered trademarks of ARM Ltd. Windows is a registered trademark of Microsoft Corporation in U.S.
and or other countries. Other terms and product names may be trademarks of others.
DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any
intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND
CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED
OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS
INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this
document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to
update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive
applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any
applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without
an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the
operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments
unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically
designated by Atmel as automotive-grade.