13.2.4 Interrupts

Because it takes a significant amount of time for a conversion to complete, most programs do not poll for completion. Instead, most programs enable ADC interrupt so that the corresponding ISR is called only after a conversion is completed.

Bit ADIE (bit 3 of ADCSRA) controls if interrupts should occur after each conversion. ADIF (bit 4 of ADCSRA) is set when an ADC conversion completes. It is cleared either by executing the ISR of ADC completion, or when a 1 is written to this bit.

This flag is useful when AD conversion is handled by polling.



Copyright © 2006-02-15 by Tak Auyeung