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

📄 main.c

📁 noise cancelation useing DSP BF537
💻 C
字号:
///////////////////////////////////////////////////////////////////////////////
//
// 	
//  Experiment 4.5_BF537 Adaptive line enhancer(ALE) with BF537 EZ-KIT
//  FILE name: main.c
//
//  Description: Perform real-time ALE to remove noisy signal.
// 		 Input consists of sine and music. ALE separates the 
//		 two at the filter and error outputs.
// 		 A few parameters can be adjusted: 
//						delay, filter tap (defined in "ALE.h")
//                      step size (in "Process.c").
// 
//  Mode of operation: SW10 (LED1 on): To select original input
//                     SW11 (LED2 on): To select sine wave
//                     Sw12 (LED3 on): To select music 
//  
//  For the book "Embedded Signal Processing with the Micro Signal Architecture"
//		  By Woon-Seng Gan and Sen M. Kuo
//		  Publisher: John Wiley and Sons, Inc.
//
//  Tools used: VisualDSP++ v4.0 (running on BF537 EZ-KIT)
//
///////////////////////////////////////////////////////////////////////////////



#include "ALE.h"

// left input data from AD1871
section("L1_data_b") short sCh0LeftIn[INPUT_SIZE];
// right input data from AD1871
section("L1_data_b") short sCh0RightIn[INPUT_SIZE];
// left ouput data for AD1854	
section("L1_data_a") short sCh0LeftOut[INPUT_SIZE];
// right ouput data for AD1854
section("L1_data_a") short sCh0RightOut[INPUT_SIZE];

// SPORT0 DMA transmit buffer
section("L1_data_a") int iTxBuffer1[2*INPUT_SIZE*TOTAL_FRAME];
// SPORT0 DMA receive buffer
section("L1_data_a") int iRxBuffer1[2*INPUT_SIZE*TOTAL_FRAME];

section("L1_data_b") fract16 LMSOutErrL[INPUT_SIZE];
section("L1_data_b") fract16 LMSOutErrR[INPUT_SIZE];
section("L1_data_b") fract16 LMSOutPredL[INPUT_SIZE];
section("L1_data_b") fract16 LMSOutPredR[INPUT_SIZE];

fract16 lmsdelayL[];
fract16 lmsdelayR[];
fract16 coefL[TAPS];
fract16 coefR[TAPS];
section ("Buffer") fract16 lmsdelayL[TAPS + INPUT_SIZE + DELAY_SIZE - 1];
section ("Buffer") fract16 lmsdelayR[TAPS + INPUT_SIZE + DELAY_SIZE - 1];

fir_state_fr16 firstateL;
fir_state_fr16 firstateR;
fract16 firdelayL[TAPS];
fract16 firdelayR[TAPS];

unsigned char ucMode;

//--------------------------------------------------------------------------//
// Function:	main														//
//																			//
// Description:	After calling a few initalization routines, main() just 	//
//				waits in a loop forever.  The code to process the incoming  //
//				data can be placed in the function Process_Data() in the 	//
//				file "Process_Data.c".										//
//--------------------------------------------------------------------------//
void main(void)
{
	pll_set_system_vco(20, 0, 0x0200);
	ucMode = OUT3;		//start by listening to error signal
	
	Init_Flags();
	Audio_Reset();
	Init_Sport0();
	Init_DMA();
	Init_PF();
	Init_Interrupts();
	Init_Filter();
	Enable_DMA_Sport0();

	while(1);
}

⌨️ 快捷键说明

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