Task: Free-running conversion on ADC channel 0. Use of conversion complete
interrupt.
In this program the initialize() routine is used to
initialize the ADC module. In free-running mode, a new conversion will be started
immediately after a conversion completes. The ADSC bit remains high during a conversion.
The time between two consecutive ADC samples depends on the ADC conversion time.
- Repeat steps 1-4 from the Single Conversion Mode.
- Set the ADC Interrupt Enable bit (ADIE) in ADCSRA equal to 1 to enable the ADC
conversion complete interrupt.
- Set the Auto Trigger Enable bit
(ADATE) in ADCSRA equal to 1 to enable auto triggered mode. By default, the Auto
Trigger Source bit fields (ADTS2:0) in ADC Control and Status Register B
(ADCSRB) is set to 000, which represents free-running mode.
- Set the Start Conversion bit (ADSC) in ADCSRA to start the first
conversion.
- After the conversion is done
(ADIF bit becomes high) the CPU executes the ADC interrupt service routine where
the ADC data register pair (ADCL/ADCH) is read to get the 10-bit ADC
result.
Test Steps
Refer to Test Steps.