ADC on Atmega328. Part 2

After we’ve learned how to perform simple ADC conversions on AVR microcontroller we can move forward with more complex tasks. AVR ADC module has many valuable features that make conversions more robust without occupying MCU resources. Imagine that we need to sample analog waveform or audio signal. It has to be done precisely at defined sampling frequency like 20kHz. The only way to do this correct is to use auto-triggering with exact time intervals. Why not pass counting task to a timer? Let’s write Timer0 auto-triggered ADC conversions with ADC complete interrupt service routine.

Continue reading