6 Generating Amplitude Modulated Signal Using 10-bit DAC

The DAC can be used to generate amplitude modulated signal. In this case, the DAC uses the voltage reference from the VREFA pin as modulation waveform (information signal), while it is configured to generate sine wave for the carrier signal.

VREF.DAC0REF = VREF_REFSEL_VREFA_gc;
V O U T = D A C n D A T A × V R E F A 1024

Therefore, the amplitude of the carrier signal will vary according to the signal that needs to be modulated.

Important: The frequency of the carrier signal must be greater than that of the information signal in order for the resulting signal to be relevant.

Based on the carrier wave frequency (SIGNAL_FREQ), the core will use a fixed number of samples (N_SAMPLES) to build the signal as described in “Generating Sine Wave Signal Using 10-Bit DAC”. The resulting sample rate will be:

S A M P L E _ R A T E = N _ S A M P L E S * S I G N A L _ F R E Q

The resulting modulated signal will be available on the DAC output external pin (PD6).

In this example, a 50 Hz sine wave is used as the carrier signal and the modulated signal is a 2 Hz sine wave from a signal generator.

Figure 6-1. Resulting Signal Visualized on Oscilloscope

Tip: The full code example is also available in Appendix.