Digital Signal Processing Reference
In-Depth Information
For the demodulator, the sampling frequency is set at 48 kHz (in lieu of 32 kHz) to
prevent aliasing and allow for the use of a bandpass filter at node 2, since the output
of the first mixer is at 16 kHz.
The signal at node 1 is the output of the modulator: a cosine wave (with an M or
W ) due to any phase shift. At node 2, it is a 16-kHz signal with a DC component.
At node 3, the signal is filtered by a 30th-order least squares FIR bandpass filter
centered at 16 kHz. The FIR filter uses a least squares design with MATLAB's
SPTool. The 16-kHz filtered signal is down-sampled (decimated) to obtain an 8-kHz
signal at node 4. The down-sampling is achieved by setting every other input value
to zero. The last stage of demodulation uses a product detector—a combination of
a mixer and a lowpass filter—to recover the original binary input. The mixer mul-
tiplies the 8-kHz signal with the original input signal. This yields two signals: one at
twice the carrier frequency and the other as a DC component with the original m ( t )
input signal. This signal is then lowpass filtered to yield the original binary signal,
regardless of the input phase. The lowpass filter is a 30th-order Kaiser FIR filter,
also designed with MATLAB's SPTool. The output at node 6 is then a 100-Hz square
wave, the same as the modulator input signal. Figure 10.34 shows the core of the C
source program bpsk _ demodulate.c for the demodulator.
// BPSK_demodulate.c Core C program for BPSK demodulation
...
double mixer_out, pd;
interrupt void c_int11()
{
input_signal=((short)input_sample()/10);
mixer_out = input_signal*input_signal;
dly[0] = mixer_out;
..
filter_output = (yn >> 15);
//output of 16 kHz BP filter
x = 0;
//init downsampled value
if (flag == 0)
//discard input sample value
flag = 1;
//don't discard at next sampling
else {
x = filter_output;
//downsampled value is input value
flag = 0;
}
pd = x * input_signal;
//product detector
dly2[0] = ((short)pd);
//for 4 kHz LP filter
..
m = (yn2 >> 15);
//output of LP filter
output_sample(m);
return;
}
void main()
{ comm_intr(); while(1); }
FIGURE 10.34. Core C program for BPSK demodulation ( bpsk_demodulate.c ).
Search WWH ::




Custom Search