Digital Signal Processing Reference
In-Depth Information
int ProcessData (int *output,int *input,int gain) //calls FIR filter
{
int i;
double filtered;
for(i=0; i<kBUFFER_SIZE; i++) {
filtered=FIRFilter(input[i]*gain,kTAPS,gFIRHistory,gFIRCoefficients);
output[i] = (int)(filtered + 0.5);}
//scale output
return 0;
}
double FIRFilter (double val,int nTaps,double* history,double* coefs)
{
//FIR Filter
double temp, filtered_val, hist_elt;
int i;
hist_elt = val;
filtered_val = 0.0;
for (i = 0; i < nTaps; i++)
{
temp = history[i];
filtered_val += hist_elt * coefs[i];
history[i] = hist_elt;
hist_elt = temp;
}
return filtered_val;
}
FIGURE 9.25. ( Continued )
( ccoefs ). The filter is implemented on the DSK by the function FIRFilter,
and the filtered output ( coutput ) is sent to Labview for plotting using
RTDX_write() . If the filter characteristics are changed, a new set of coeffi-
cients ( ccoefs ) is calculated within Labview and sent to the DSK through
RTDX.
Example 9.12: LabVIEW-DSK Interface Using RTDX for Controlling the
Gain of a Generated Sinusoid ( rtdx_lv_gain )
In this example, LabVIEW is used to control the amplitude of a generated sine wave
and to plot the scaled output sine wave. An array of data representing the gener-
ated sine wave and a gain value are sent from LabVIEW to the DSK. Through
RTDX, the C6x on the DSK scales the received sine wave input data and sends the
resulting scaled output waveform to LabVIEW for plotting. The necessary files for
this example are in the folder rtdx_lv_gain .
1. Click on the LabVIEW Instrument ( .vi ) file rtdx_lv_gain to obtain
Figure 9.26. Run it as in Example 9.11. The project rtdx_lv_gain.pjt is
Search WWH ::




Custom Search