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

📄 isr.c

📁 noise cancelation useing DSP BF537
💻 C
字号:
///////////////////////////////////////////////////////////////////////////////
//
// 	
//  Experiment 4.5_BF537 Adaptive line enhancer (ALE) with BF537 EZ-KIT
//  FILE name: ISR.c
//
//  Description: Perform real-time ALE to remove noisy signal.
//		 Interrupt service routine to handle real-world signal.
//  
//  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"

EX_INTERRUPT_HANDLER(Sport0_RX_ISR)
{
	int i;
	static short j=0,k=0;
	
	// confirm interrupt handling
	*pDMA3_IRQ_STATUS = 0x0001;
	
	for (i = 0; i < INPUT_SIZE; i++)
	{
		// copy input data from dma input buffer into variables
		sCh0LeftIn[i] = iRxBuffer1[INTERNAL_ADC_L0+j] >> 8;
		sCh0RightIn[i] = iRxBuffer1[INTERNAL_ADC_R0+j] >> 8;
		
		// use the builtin circular buffer to update the index
		j = __builtin_circindex(j, 2, 2*INPUT_SIZE*TOTAL_FRAME);
	}
	
	// call function that contains user code
	Process_Data();				

	for (i = 0; i < INPUT_SIZE; i++)
	{
		// copy processed data from variables into dma output buffer
		iTxBuffer1[INTERNAL_DAC_L0+k] = sCh0LeftOut[i] << 8;
		iTxBuffer1[INTERNAL_DAC_R0+k] = sCh0RightOut[i] << 8;

		// use the builtin circular buffer to update the index
		k = __builtin_circindex(k, 2, 2*INPUT_SIZE*TOTAL_FRAME);
	}
}

EX_INTERRUPT_HANDLER(Switch_ISR)
{
	int i;
	
	if (*pPORTFIO & PF2)
	{
		*pPORTFIO_CLEAR = PF2;
	}
	
	if (*pPORTFIO & PF3)
	{
		*pPORTFIO_CLEAR = PF3;
		
		ucMode = OUT3;
	}
	
	if (*pPORTFIO & PF4)
	{
		*pPORTFIO_CLEAR = PF4;
		
		ucMode = OUT2;	
	}
	if (*pPORTFIO & PF5)
	{
		*pPORTFIO_CLEAR = PF5;
		
		ucMode = OUT1;
		
		// reset
		for (i = 0; i < TAPS; i++)
		{
			coefL[i] = 0;
			firdelayL[i] = 0;
			lmsdelayL[i] = 0;
			coefR[i] = 0;
			firdelayR[i] = 0;
			lmsdelayR[i] = 0;
		}
		
		for (i=TAPS; i<TAPS+INPUT_SIZE+DELAY_SIZE-1; i++)
		{
			lmsdelayL[i] = 0;
			lmsdelayR[i] = 0;
		}
	}
	
	*pPORTFIO_CLEAR		= 0x0FC0;
	*pPORTFIO_SET 		= ucMode << 4;	
}
	


⌨️ 快捷键说明

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