Lab 8: IQmath FIR Filter
Select a Global IQ value
6. Open the file c:\tidcs\c28\IQmath\cIQmath\include\IQmathLib.h.
Confirm that the GLOBAL_Q type (near beginning of file) is set to a value of 24. If it is
not, modify as necessary:
#define GLOBAL_Q 24
Recall that this Q type will provide 8 integer bits and 24 fractional bits. Dynamic range
is therefore -255 <
x < +255, which is sufficient for our purposes in the workshop.
IQmath Single-Sample FIR Filter
7. Open and inspect DefaultIsr_8.c. Notice that the ADCINT_ISR calls the IQmath
single-sample FIR filter function, IQssfir(). The filter coefficients have been defined in
the beginning of the file. Now open and inspect the IQssfir() function in Filter.c.
This is a simple, unoptimized coding of a basic IQmath single-sample FIR filter.
Build and Load
8. Click the “Build” button.
9. Reset the DSP.
Run the Code – Filtered Waveform
10. Open a memory window to view some of the contents of the filtered ADC results buffer.
The address label for the filtered ADC results buffer is AdcBufFiltered. Set the Q-Value
to 24 (which matches the IQ format being used for this variable) and the Format to 32-Bit
Signed Int. We will be running our code in real-time mode, and need to have our window
continuously refresh. Enable Real-time Mode and be sure that the Global
Continuous Refresh option has been checked.
Note: For the next step, check to be sure that the jumper wire connecting “VREFLO”
(pin # P9-18) to “GND” (pin # P9-17) and the wire connecting PWM1 (pin # P8-9) to
ADCIN0 (pin # P9-2) are still in place on the eZdsp™.
11. Run the code in real-time mode and watch the memory window update. Verify that the
ADC result buffer contains updated values.
12. Open and setup a dual time graph to plot a 50-point window of the filtered and unfiltered
ADC results buffer. Click: View Graph Time/Frequency… and set the
following values:
8 - 38 C28x - Numerical Concepts & IQmath