I guess you used the sine wave article from the below link,
so i go ahead with the code explanation for this " SINE WAVE GENERATION USING TMS320C6745 DSP " article.
There are so many ways to generate the sine wave but in this article i used usual sine formula to generate the sine samples. Those sine samples only we seeing in the CCS Graph feature.
1. First assume the below factors to generate the sine samples and declare suitable datatype variables for the values.
Sampling Frequency in Hz = 1024000
Input Frequency in Hz = 4000
const float sampf = 1024000.0;// Sampling frquency is fixed
const int inpf = 4000; // change the input frquency from 1khz to 8khz(1000 to 8000)
2. Declaring a SDRAM memory location to store samples.
sinout = (short *)0xc0000000;
3. Formula for No.of.Sample,
No.of.Sample = ( Sampling Frequency in Hz / Input Frequency in Hz ) = (1024000/4000) = 256 Samples
Sampling Time in Sec = ( 1 / Sampling Frequency in Hz) = (1/1024000) = 0.0000009765625 Sec
sampt = 1/sampf;
nsamp = sampf/inpf;
4. Printf Statement to know the calculation values, it display the output in CCS console window.
Note: replace the single quote to double quote in all the printf statement
printf('\n Sampling Frequency is : %f',sampf);
printf('\n Sampling Time is :%f',sampt);
printf('\n Input Frequency is : %d',inpf);
printf('\n The number of Sample is : %d',nsamp);
5. Before write the samples to SDRAM , clearing the memory location
6. Formula for sine wave,
x(n) = Sin( 2 * pi * Input Frequency in Hz * Sampling Time in Sec * n)
where n is the nth sample
teta = (2 * PI * inpf * sampt * count);
printf('\nteta = %lf',teta);
value = sin(teta)*1024;
printf('\t sin %lf Value is : %d',teta,value);
value1 = value&0x0000FFFF;
*sinout++ = value1;
7. Store the sine samples in DSP SDRAM memory location, so that we can view sine samples in CCS Graph window.
I clearly explained the coding , kindly let me know your status.