Other Parts Discussed in Thread: C2000WARE
Hi all,
I am trying to generate a sinusoidal signal of around 10 KHz using the following code from F280049C.
// Initialization
ConfigCpuTimer(&CpuTimer0, 100, 5);
// ISR
wt = wt + Ts_Freq; // Ts_Freq = 0.05 = 10 KHz * 5e-6; Ts = 5e-6 (200 KHz)
if (wt > 1.0)
wt = wt - 1.0;
else if (wt < -1.0)
wt = wt + 1.0;
else
wt = wt;
sin_gen = __sinpuf32(wt);
The output is given to a DAC and filtered using a BPF. The generated signal is sinusoidal but with an offseted frequency of around 6-7 Hz. This is same for any"Freq" given. All variables are in single float.
I have saved the output in DSC internal memory (for around 7000 samples due to memory limitation) and took an FFT which gave a peak at 3.0 Hz frequency offset from the set value.
What may be the reason for the same ?
Thanks and Regards
Karthik
