This is the quick start guide for the SAM3S/4E/4S/V71/V70/S70/E70 Analog Comparator Controller (ACC) Driver, with step-by-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.
This use case will demonstrate how to initialize the ACC module in interrupt mode.
This module requires the following service:
Add this to your main application C-file:
void ACC_Handler(void) { }
Add this to the main loop or a setup function:
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(); }