网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> DSP >> 代码示例 >> TI DSP代码示例 >> C5000 >> 文章正文
  FSK信号鉴频的程序         ★★★ 【字体:
FSK信号鉴频的程序
作者:61IC    文章来源:本站原创    点击数:    更新时间:2007-1-22    

/*******************************************************************/
/*******************************************************************/
/* This program implements the function of finding out the largest */
/* and the second largest values of the sequence of "in_buffer[10]"*/
/*******************************************************************/
/*******************************************************************/

#include <stdio.h>
#include <math.h>
#include "freq_max_finding.h"

//extern float cosf(float x);
extern int in_buffer[10]={0,0,0,0,0,0,0,0,0,0}; /* in_buffer[]中的值为频谱点 */
//int out_buffer[2];

static void dataIN(void);

void main()
{
 int  i=0;
// float  data_max=0;
 int  data_max=0;
// float  data_max2=0; 
 int     data_max2=0;
 
 int  i_max=0;
 int  i_max2=0;
 
 float  f_max=0;
 float  f_max2=0;
 
 int  p=0;
 int  q=0;
 
// float a=0, b=3.14159;
// a=a+0;
// b=b+0;
// a=cosf(b);

 /**********************************************************/
 /** 几句废话,消除warning:data_max was set but never used **/
 data_max=data_max+0;
 data_max2=data_max2+0;
// i_max=i_max+0;
// i_max2=i_max2+0;
 f_max=f_max+0;
 f_max2=f_max2+0;
 /**********************************************************/
 
 dataIN(); /* read data into memory */
 
 
/************************************************/ 
/** find out the greatest value of "in_buffer" **/

 for(i=0;i<=POINT_ALL-2;i++)
  {
   if (in_buffer[i+1]>in_buffer[i])
      {data_max=in_buffer[i+1]; i_max=i+1;}
     
   else {data_max=in_buffer[i]; i_max=i;} 
  }

 f_max=FS*i_max/POINT_ALL; /* calculate the value of carrier frequency */
 
/************************************************/ 

 
/*****************************************************/             
/* find out the second greatest value of "in_buffer" */ 

  in_buffer[i_max]=0; /* set 0 to "in_buffer[i_max]"*/
  
  for(p=1;p<=POINT_ALL/2;p++)
   {
    for(q=0;q<=POINT_ALL/2-2;q++)
     {
        if (in_buffer[q+1]>in_buffer[q]) 
          {data_max2=in_buffer[q+1]; i_max2=q+1;}
          
        else {data_max2=in_buffer[q]; i_max2=q;}
      }
     
    /* determines the availability of i_max2 through
       estimating the distance of i_max between i_max2 */
    if (abs(i_max-i_max2)<=GAP) in_buffer[i_max2]=0;
    else break;
   }
   
  f_max2=FS*i_max2/POINT_ALL; /* calculate the value of carrier frequency2 */
  
/*****************************************************/  
 
 while(1);
}


static void dataIN()
{
 /* do read data from host file */
 return;
}

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    没有相关文章
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号