⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exp04.c

📁 在ccs环境下的c语言编程主要实现ad采样在对其进行FFT变换
💻 C
字号:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "typedef.h"
ioport unsigned int port0000;
interrupt void timer();
void time();
void initial();
void closetime();
int 	i=0;
int 	c=0;
int 	temp=0;
struct 	compx s[257];  
float 	result[257];
int 	Num=256;
int 	datas[257];
int 	flag=0;
interrupt void timer()
{
	temp++;
	if(temp==5) 
	{  temp=0;
		if(i==256)
		{   
			asm(" nop");
			for(;c<256;c++)
			{ 
		s[c].real=datas[c];
		s[c].imag=0;
			}
 			FFT(s,Num);
			for(c=1;c<257;c++)
			{
		result[c]=sqrt(pow(s[c].real,2)+pow(s[c].imag,2));
			}
			flag=1;
		}
		else
		{asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
		asm(" nop");
	    datas[i]=port0000;	  
	    i++;  
		}
	}   
	return;
} 

main()
{	initial();
	while(1){
	;if(flag==1)
  		{closetime();
     		break;
       	}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -