ECE 6580 Lecture 7 FIR in C Fir

  • Slides: 16
Download presentation
ECE 6580 Lecture 7

ECE 6580 Lecture 7

FIR in C Fir. Coefs. m EZ-Kit Board Matlab Fir. h VDSP Fir. Coefs.

FIR in C Fir. Coefs. m EZ-Kit Board Matlab Fir. h VDSP Fir. Coefs. c Fir. Coefs. h Main. c Project Files

Fir. Coef. c float Fir. Coef[N] = { a 1, a 2, . .

Fir. Coef. c float Fir. Coef[N] = { a 1, a 2, . . . a N, };

Fir. Coef. h Extern float Fir. Coef[ ];

Fir. Coef. h Extern float Fir. Coef[ ];

fir. c //================= // This function calculates an finite impulse response filter // It

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 a 0, a 1, …a. N U 32 order) // order of filter {. . . }

fir. h //================= // This function calculates an finite impulse response filter // It

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 a 0, a 1, …a. N U 32 order); // order of filter

Measure Frequency Response Pink. Noise. Correlated. wav SIA Smaart USB EZ-Kit Board Line Out

Measure Frequency Response Pink. Noise. Correlated. wav SIA Smaart USB EZ-Kit Board Line Out (Green) PC 1 MIC In (Pink) PC 2

Debug Techniques • • Break Points Single Step Watch Windows Plots LEDs Test Files

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

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

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

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

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

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

Test Files • A good example of a test file for Lab 2 would be a different Filter. Coefs. 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

SIA Smaart • Very good for measuring frequency responses real time. (RTA) • Good for measuring Transfer Functions.

Remember to use Class coding standards

Remember to use Class coding standards