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

📄 list.5.txt

📁 This archive contains circuit diagram and text documents making up the design of audio spectrum anal
💻 TXT
字号:
	while(1)
	{
		unsigned long i;

		//Sampling
		Sampling(Samples);

		//Multiplying by window's factors
		if(WinType==wtHanning)
			Hanning(Samples);
		else if(WinType==wtHamming)
			Hamming(Samples);

		//Computing Spectrum (FFT)
		FFT(Samples,FFTResult);

		//Computing squared modules of FFTResult (Spectrum)
		for(i=0;i<N;i++)
		{
			fix Re2,Im2;

			//Scaling by N/2=128
			FFTResult[i].Re>>=7;
			FFTResult[i].Im>>=7;

			//Squareing
			Re2=FMUL(FFTResult[i].Re,FFTResult[i].Re,q);
			Im2=FMUL(FFTResult[i].Im,FFTResult[i].Im,q);
			Spectrum[i]=Re2+Im2;
		}

		//Changing the window
		if(!SW1 | !SW2 | !SW3)
		{
			delay(0x800);
			if(!SW1)
				WinType=wtNone;
			else if(!SW2)
				WinType=wtHanning;
			else if(!SW3)
				WinType=wtHamming;

			DisplayWindowType(WinType);
		}

		//Checking request
		if((U0LSR & 0x01)==0)
			continue;

		//Sending spectrum to PC (if requested)
		SendSpectrumInfo(Spectrum,WinType);

		//Empty input buffer by dummy reading
		while(U0LSR & 0x01)
			i=U0RBR;
	}

⌨️ 快捷键说明

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