Hey. I need to generate a variable frequency sinewave using DAC. I have implement sine wave look up table and phase accumulator:
DDS generating variable frequency(1Hz - 20kHz) sinewave using DAC
Code (C):
- void SINE_LOOKUP_TABLE(){
- const int BUFF_SIZE = 4096; // size of output buffer (samples)
- const int Fs = 32.768; // sample rate (Hz)
- const int LUT_SIZE = 1024; // lookup table size
- int16_t LUT[LUT_SIZE]; // our sine wave LUT
- for (int i = 0; i < LUT_SIZE; ++i)
- {
- LUT[i] = (int16_t)sinf(((float)i *360)/1024) *2047;
- }...