160 likes | 177 Views
Calculates finite impulse response filter with float inputs and coefficient pointers. Useful for signal processing applications. Developed by D.R.Judd in 2003.
E N D
FirCoefs.m FirCoefs.c FirCoefs.h Project Files Main.c Fir.h Fir.c FIR in C EZ-Kit Board Matlab VDSP
FirCoef.c float FirCoef[N] = { a1, a2, . . . aN, };
FirCoef.h Extern float FirCoef[ ];
fir.c //================================== // This function calculates an finite impulse response filter // It accepts as inputs: // x: input of type float // states: a pointer to float of the filter states, // the size of the states array should be // order, where order is the filter order // coefs: a pointer to float of the filter coefficients. // The size of this array should be order + 1. // order: The order of the filter. // Writtten by D.R.Judd 1/21/2003 //==================================== float fir( float x, // input to be filtered float *states, // states for filter delay line float *coefs, // coefs for filter a0,a1,…aN U32 order) // order of filter { . . . }
fir.h //================================== // This function calculates an finite impulse response filter // It accepts as inputs: // x: input of type float // states: a pointer to float of the filter states, // the size of the states array should be // order, where order is the filter order // coefs: a pointer to float of the filter coefficients. // The size of this array should be order + 1. // order: The order of the filter. // Writtten by D.R.Judd 1/21/2003 //==================================== float fir( float x, // input to be filtered float *states, // states for filter delay line float *coefs, // coefs for filter a0,a1,…aN U32 order); // order of filter
EZ-Kit Board Measure Frequency Response PinkNoiseCorrelated.wav SIA Smaart USB Line Out (Green) MIC In (Pink) PC1 PC2
Debug Techniques • Break Points • Single Step • Watch Windows • Plots • LEDs • Test Files • SIA Smaart
Break Points • Double Click to the left of the line. • Warning, if you halt on a break point that is not in the ISR, then you must clear the break point before continuing.
Single Step • Step over • Step into • Step out of • It is always a good idea to single step through new code. It usually saves time in the long run. • Never single step when you are not in the ISR unless you disable interrupts.
Watch Windows • View/Debug Windows/Locals • View/Debug Windows/Expressions
Plots • View/Debug Windows/Plot/New • View/Debug Windows/Plot/Restore • Warning, the more plots that you have and the larger they are, the slower your response time.
LEDs • It is good to blink an LED when you are in the main loop, to make sure that it does not stay in the ISR all the time. • It is good to blink an LED when you are in the ISR, to make sure interrupts are happening. • Warning, blink slowly.
Test Files • A good example of a test file for Lab 2 would be a different FilterCoefs.c file with all zeros for the coefficients except one. • Test files are algorithm dependent.
SIA Smaart • Very good for measuring frequency responses real time. (RTA) • Good for measuring Transfer Functions.
Remember to use Class coding standards