Free-Running Interrupt Mode

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.

  1. Repeat steps 1-4 from the Single Conversion Mode.
  2. Set the ADC Interrupt Enable bit (ADIE) in ADCSRA equal to 1 to enable the ADC conversion complete interrupt.
  3. 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.
  4. Set the Start Conversion bit (ADSC) in ADCSRA to start the first conversion.
  5. 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.