Introduction

Authors: Cristian Sabiuta, Marius Nicolae, Microchip Technology Inc.

The AVR® DA MCU family of microcontrollers is based on the AVR architecture and brings a DAC peripheral equipped with 10-bit resolution and high-drive capabilities, helping the user to generate precise analog voltages and use them internally or externally on a physical pin.

This technical brief describes how the 10-bit DAC works on the AVR DA microcontroller family, covering the following use cases:

  • Generating Constant Analog Signal Using 10-Bit DAC:

    Initialize the DAC, set the voltage reference, set the DAC to output a specific constant voltage.

  • Generating Sine Wave Signal Using 10-Bit DAC:

    Initialize the DAC, set the voltage reference, output in a loop the samples of a sine wave.

  • Reading the DAC Internally with the ADC:

    Initialize the DAC and ADC, set the voltage reference, set the ADC to read the DAC, increment the DAC output and read it with the ADC for each step.

  • Generating Amplitude Modulated Signal Using 10-Bit DAC:

    Initialize the DAC with external reference and link the signal that must be modulated to the external reference pin. The AVR core will continuously change the Data (DACn.DATA) register to create a modulated signal.

Note: The code examples were developed on AVR128DA48 Curiosity Nano.