Noise Reduction Sleep

Task: Use of ADC noise reduction sleep.

In this program, the initialize() routine is used to initialize the ADC module. The example uses ADC noise reduction sleep mode. Enter the sleep mode by executing 'sleep' instruction. The ADC will start a conversion after the CPU has been halted. As the ADC conversion complete interrupt is enabled, the Interrupt Service Routine for this interrupt will be triggered as soon as the conversion is completed. ADSC bit remains high during a conversion. When the execution of ISR is finished, the execution comes to the main routine and it executes 'sleep' again, which triggers another conversion.

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