Sine wave look up table calculations does not match online generator

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hey. I am trying to learn DDS and how to create a varying frequency sine wave using DAC.
upload_2019-8-12_9-38-16.png

I am using formula above to calculate sample values for my sine wave. In my case, I am using 1024 points and full scale is 4095.
When n=1, the calculated value is 25,126
when n=2, the calculated value is 50.25 (Assume zero value is 0)

I am checking my calculations with the sine look up table generator:
upload_2019-8-12_9-39-51.png

And I can see that the value n[0] is 2048 which is half of the maximum value 4095,
n[1] is 2060 which is 12 higher then 2048, however, in my case I have calculated it to be 25,126. Any ideas why would that be?
 

Attachments

Last edited:

Thread Starter

zazas321

Joined Nov 29, 2015
936
Why is it 2047? I am using 12 bit DAC which means that the full scale is (2^12 -1) = 4095 .
Is that not right?
 

kubeek

Joined Sep 20, 2005
5,794
That is not right. That is full scale of the ADC, but you want the center of the sine wave at 2048, so you have only 4095-2048=2047 points for it to go positive, and another 2048 points that it can go negative. So you need to multiply the sine by 2047 or less in order for the signal to not get limited.
 
Top