Go Down

Topic: Control sine amplidute using DACC (Read 882 times) previous topic - next topic

matanh

Hi,

I am using the great sine/cosine wave generator:
https://forum.arduino.cc/index.php?topic=402784.0

I am looking for a way to change the output amplitude using DACC.

Any ideas?

Matan

ard_newbie

#1
Dec 23, 2019, 04:05 pm Last Edit: Feb 06, 2020, 06:17 am by ard_newbie

Suppose a sinwave oscillation between 0 and 2^12 = 4095. Multiply this sinwave by a float Amplitude:

float Output   = Amplitude * sinwave, with 0<= Amplitude <= 1. Keep the integer part of Output (OutDAC = (uint16_t)Output) and fill the DAC with OutDAC values.

You can choose to vary Amplitude with a potentiometer.

matanh

Thanks for the reply ard_newbie,

Using DACC direct register programming I control the sampling rate which is crucial for my application. As far as I understand the example, there is a constant hex vector of sine wave and using DACC direct register programming we can control the sampling rate which creates different frequencies.

I need to maintain the ability to output different frequencies but to generate modulation amplitude signal (attached).

Thanks again,
Matan


Go Up