#include "ADDS_21161_EzKit.h" #include #include float *DelayLine; float result; float sample; int PushB = 0; int Leds = 0; #define BL 35 // filtr dolnoprzepustowy const float B[BL] = { -7.103170713334e-005, 0.0001968257635756, 0.0006682939387273, 0.001626131564274, 0.003279773024188, 0.005853780135691, 0.009551935781492, 0.01451753074126, 0.02079529785399, 0.0283004503543, 0.03679960783764, 0.04591120983338, 0.05512714865275, 0.0638538632074, 0.0714706589283, 0.07739731344369, 0.08116056231762, 0.08245085237448, 0.08116056231762, 0.07739731344369, 0.0714706589283, 0.0638538632074, 0.05512714865275, 0.04591120983338, 0.03679960783764, 0.0283004503543, 0.02079529785399, 0.01451753074126, 0.009551935781492, 0.005853780135691, 0.003279773024188, 0.001626131564274, 0.0006682939387273, 0.0001968257635756, -7.103170713334e-005 }; /* #define BL 35 // filtr gornoprzepustowy const float B[BL] = { -0.01821557208689, 0.001821786662332, 0.004446980184417, 0.00815973418759, 0.01219861220061, 0.01545920375312, 0.01671050744477, 0.0148171344187, 0.00892269110748, -0.001397738085135, -0.01600423985212, -0.0341218791864, -0.05438294725561, -0.07497752242853, -0.09387542805209, -0.109090635077, -0.1189584708181, 0.8776238973999, -0.1189584708181, -0.109090635077, -0.09387542805209, -0.07497752242853, -0.05438294725561, -0.0341218791864, -0.01600423985212, -0.001397738085135, 0.00892269110748, 0.0148171344187, 0.01671050744477, 0.01545920375312, 0.01219861220061, 0.00815973418759, 0.004446980184417, 0.001821786662332, -0.01821557208689 }; */ float probki[BL]; int ActSInd=BL-1; int coff_ind=0; int i; float out; // Obsluga przerwan przyciskow: void Process_IRQ_0(int sig_int) { *(int*) IOFLAG ^= FLG8; } void Process_IRQ_1(int sig_int) { *(int*) IOFLAG ^= FLG9; } void Process_IRQ_2(int sig_int) { *(int*) IOFLAG ^= FLG9|FLG8; } // Obsluga przerwania portow kodeka (zmodyfikowana przez MK) void Process_Samples( int sig_int) { Receive_Samples(); /***********************************************/ i=ActSInd; out=0; coff_ind=0; probki[i]=Left_Channel_In1/6; // Dzielimy na 6 aby uniknąć błędu przepełnienia for (;coff_ind(BL-1)) i=0; } if ((--ActSInd)<0) ActSInd=BL-1; Left_Channel_Out0 = out/2; Right_Channel_Out0 = out/2; /***********************************************/ Transmit_Samples(); } void main() { // Inicjalizacja kodeka, ustalenie podprogramów przerwań Setup_ADSP21161N(); Setup_SDRAM(); Setup_AD1836(); Program_SPORT02_TDM_Registers(); Program_SPORT02_DMA_Channels(); interruptf( SIG_SP0I, Process_Samples); *(int *) SP02MCTL |= MCE; // Wejcie w nieskończoną pętlę. Czekamy na przerwania kodeka informujące o pobraniu próbki. for (;;) asm("idle;"); }