This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

请问CCS3.3环境下,DSPC6743,用timer.h中的clock()函数测试程序运行时间然后printf,但结果总是0????这是怎么回事

补充:我用CCS3.3环境的clock工具的话,测试时间是30ms左右,但是用定时器测试的话是1s左右,请问这是什么原因???是我定时器测出的结果不对吗?

 

主程序 如下:

void main(void)
{
 Uint32 i,j,n,k;
 clock_t start,stop,overhead;

 /* 初始化6747核 */
  C6747_init( );

  start=clock();
  stop=clock();
  overhead=stop-start;

  start=clock();
  initTIMER0();//初始化定时器0
  TIMER0_TRC=0x00000080;    //开定时器

 for(n=0;n<N;n++)
{

//printf("the times is %d\n",n);
 for(i=0;i<9;i++)     //矩阵赋初值
 {
  for(j=0;j<2;j++)
  {
    V[i][j]=0;
    A[i][j]=0;
    jisuan[j][i]=0;
   }
 }
 

  for(i=0;i<9;i++)     //取输出数据进行运算
 {
 
    V[i][0]=fad[i][4]-fad[i][6];
 V[i][1]=fad[i][3]-fad[i][5];
  
  }

   jbbd();
   jbfbd();
 
   //printf("%f,%f,%f,%f\n",iKa[0][0],iKa[0][1],B[0][0],B[0][1]);

 }

  k=TIMER0_TIM12;
  TIMER0_TRC=0x00000000;    //开定时器
  stop=clock();
  //overhead=stop-start;

  printf("%d",stop-start-overhead);
 }

 

x 出现错误。请重试或与管理员联系。