请大神帮我修改一个CCS编译问题
ccs吧
全部回复
仅看楼主
level 1
7798146512 楼主
编译成功了~~但我RUN的时候他说Can't Run Target CPU~
为什么~~有谁会修改吗
以下是程序
#include "stdio.h"
#include "math.h"
void generate(float dtmf[],int start,int num);
void detect(float dtmf[],int start);
int data;
float freq[10][2]={{941,1336},{697,1209},{697,1336},{697,1447},
{770,1209},{770,1336},{770,1447},{852,1209},{852,1336},{852,1447}};
float pi=3.1415926;
void main()
{
int i;
float dtmf[8*800];
generate(dtmf,0*800,5);
for(i=0;i<8;i++)
{
detect(dtmf,800*i);
}
return;
}
void generate(float dtmf[],int start,int num)
{
float x=0,y=0,z=0;
int j;
x=freq[num][0]/8000*2*pi;
y=freq[num][1]/8000*2*pi;
for(j=1;j<=400;j++)
{
z=sin(x*j)+sin(y*j);
dtmf[start+j-1]=z/2;
dtmf[start+j-1+400]=0;
}
}
void detect(float dtmf[],int start)
{
int i,j,x,y;
float w[8],b[8][3],result[8];
w[0]=2*cos(2*pi*18/205);
w[1]=2*cos(2*pi*20/205);
w[2]=2*cos(2*pi*22/205);
w[3]=2*cos(2*pi*24/205);
w[4]=2*cos(2*pi*31/205);
w[5]=2*cos(2*pi*34/205);
w[6]=2*cos(2*pi*37/205);
w[7]=2*cos(2*pi*42/205);
for(i=0;i<8;i++)
{
b[i][0]=0;
b[i][1]=0;
for(j=1;j<=205;j++)
{
b[i][2]=w[i]*b[i][1]-b[i][0]+dtmf[start+j-1];
b[i][0]=b[i][1];
b[i][1]=b[i][2];
}
result[i]=b[i][1]*b[i][1]+b[i][0]*b[i][0]-w[i]*b[i][1]*b[i][0];
}
j=0;
for(i=0;i<8;i++)
{
if(result[i]>100)
{
j++;
printf("dtmf[%d]:%f\r\n",i,result[i]);
if(j==1)
{
x=i;
}
else if(j==2)
{
y=i;
}
}
}
i=-1;
if(j==2)
{
if(x==0 && y==4)
{
i=1;
}
else if(x==0 && y==5)
{
i=2;
}
else if(x==0 && y==6)
{
i=3;
}
else if(x==1 && y==4)
{
i=4;
}
else if(x==1 && y==5)
{
i=5;
}
else if(x==1 && y==6)
{
i=6;
}
else if(x==2 && y==4)
{
i=7;
}
else if(x==2 && y==5)
{
i=8;
}
else if(x==2 && y==6)
{
i=9;
}
else if(x==3 && y==5)
{
i=0;
}
}
if(i!=-1)
{
printf("The DTMF signal is %d.\r\n",i);
}
}
2014年04月13日 09点04分 1
1