Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <c6x.h>;
- int main(void)
- {
- int i;
- int j;
- int k=33;
- int x=0;
- int phase[256];
- short phase1p[256];
- unsigned short sin1p[]={
- 0,1559,3114,4663,6201,7725,9231,10717,12178,13611,15014,16383,17715,
- 19006,20255,21457,22611,23714,24763,25756,26691,27565,
- 28377,29124,29805,30419,30964,31439,31843,32174,32433,32618,32729
- };
- short out[256];
- for (i=0; i<256; i++)
- {
- x=k*i;/*Edit phase for all period*/
- phase[i] = x;
- //phase[i]=_extu(x,19,19);
- if (phase[i]<=2048)
- {
- phase1p[i]=_extu(phase[i],0,4);
- j=phase1p[i];
- out[i]=sin1p[j];
- }
- if (phase[i]>2048)
- {
- phase1p[i]=_extu(4096-phase[i],0,4);
- j=phase1p[i];
- out[i]=sin1p[j];
- }
- if (phase[i]>4096)
- {
- phase1p[i]=_extu(phase[i]-4096,0,4);
- j=phase1p[i];
- out[i]=-sin1p[j];
- }
- if (phase[i]>6144)
- {
- phase1p[i]=_extu(8192-phase[i],0,4);
- j=phase1p[i];
- out[i]=-sin1p[j];
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment