Chinaunix首页 | 论坛 | 博客
  • 博客访问: 232340
  • 博文数量: 17
  • 博客积分: 547
  • 博客等级: 中士
  • 技术积分: 276
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-23 20:35
文章分类

全部博文(17)

文章存档

2011年(17)

分类: 嵌入式

2011-08-13 22:26:30

/******************** (C) COPYRIGHT 2011 NETCreate ****************************
* 产品名称:信号分析仪
* 文件名称: fft.c
* 程序作者: NETCreate
* 程序版本: V1.1.0
* 编制日期: 2011/7/20
* 功能描述: fft函数.
********************************************************************************
* 芯片型号 : STM32F103ZET6
* 采用: 8.0000Mhz
* 程序算法为NETC原创
*******************************************************************************/
/******************** (C) COPYRIGHT 2011 NETCreate ********************
* File Name          : fft.c
* Author             : NETC
* Version            : V1.0.0
* Date               : 2011/7/20
* Description        : FFT FUNCTION.                     ********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
/* 文件包含 ------------------------------------------------------------------*/
#include "main.h"
/* Private typedef -----------------------------------------------------------*/
/* 私有类型-------------------------------------------------------------------*/
typedef unsigned int u32
/* Private define ------------------------------------------------------------*/
/* 私有宏定义-----------------------------------------------------------------*/
#define PI 3.1415
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* 私有变量 ------------------------------------------------------------------*/
u32 Freq;
/* Private function prototypes -----------------------------------------------*/
/* 私有函数原型---------------------------------------------------------------*/
void MygSin(long nfill, long Fs, long Freq1, long Freq2, long Ampli);

/* Private functions ---------------------------------------------------------*/
/* 私有函数-------------------------------------------------------------------*/

 /*------------------- Drivers Initialization -------------------------------*/
 /*---------------------------设备初始化 ------------------------------------*/
/*******************************************************************************
* Function Name  : MygSin
* Description    : Two Sine Function Draw.
* Input          : nfill,Fs,Freq1,Freq2,Ampli.
* Output         : None
* Return         : None
*******************************************************************************/
/*******************************************************************************
* 函数名称: MygSin
* 功能描述: Two Sine Function Draw.
* 输入参数: nfill,Fs,Freq1,Freq2,Ampli.        
* 输出参数: None
* 返回参数: None
*******************************************************************************/
void MygSin(long nfill, long Fs, long Freq1, long Freq2, long Ampli)
{
 
  u32 i;
  float fFs, fFreq1, fFreq2, fAmpli;
  float fZ,fY;
  fFs = (float) Fs;
  fFreq1 = (float) Freq1;
  fFreq2 = (float) Freq2;
  fAmpli = (float) Ampli;
  for (i=0; i < nfill; i )
  {
    fY = sin(PI2 * i * (fFreq1/fFs)) sin(PI2 * i * (fFreq2/fFs));
    fZ = fAmpli * fY;
    lBUFIN[i]= ((short)fZ) << 16 ;  /* sine_cosine  (cos=0x0) */
  }
}
 
/******************* (C) COPYRIGHT 2011 NETCreate *****END OF FILE****/
 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_ADC_H
#define __STM32F10x_ADC_H
 
#endif /*__STM32F10x_ADC_H */
阅读(2969) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~