02.08.2013 Views

A Software Defined Radio for the Masses, Part 3

A Software Defined Radio for the Masses, Part 3

A Software Defined Radio for the Masses, Part 3

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

domain. I would appreciate comments<br />

from knowledgeable readers on this<br />

hypo<strong>the</strong>sis.<br />

The IFFT and Overlap/Add—<br />

Conversion Back to <strong>the</strong> Time<br />

Domain<br />

Be<strong>for</strong>e returning to <strong>the</strong> time domain,<br />

we must first convert back to<br />

Cartesian coordinates by using<br />

nspdbrPolarToCart as illustrated in<br />

Fig 15. Then by setting <strong>the</strong> NSP_Inv<br />

flag, <strong>the</strong> inverse FFT is per<strong>for</strong>med by<br />

nspzrFftNip, which places <strong>the</strong> timedomain<br />

outputs in RealOut() and<br />

ImagOut(), respectively. As discussed<br />

previously, we must now overlap and<br />

add a portion of <strong>the</strong> signal from <strong>the</strong><br />

Fig 17—Digital AGC flow diagram.<br />

8 Nov/Dec 2002<br />

previous capture cycle as described in<br />

<strong>the</strong> DSP Guide (see Note 13).<br />

Ioverlap() and Qoverlap() store <strong>the</strong> inphase<br />

and quadrature overlap signals<br />

from <strong>the</strong> last pass to be added to <strong>the</strong><br />

new signal block using <strong>the</strong> nspdbAdd3<br />

routine.<br />

Digital AGC with<br />

Variable Hang Time<br />

The digital AGC code in Fig 16 provides<br />

fast-attack and -decay gain control<br />

with variable hang time. Both attack<br />

and decay occur in approximately<br />

1 ms, but <strong>the</strong> hang time may be set to<br />

any desired value in increments of<br />

46 ms. I have chosen to implement <strong>the</strong><br />

attack/decay with a linear ramp<br />

function ra<strong>the</strong>r than an exponential<br />

function as described in DSP communications<br />

texts. 15 It works extremely<br />

well and is intuitive to code. The flow<br />

diagram in Fig 17 outlines <strong>the</strong> logic<br />

used in <strong>the</strong> AGC algorithm.<br />

Refer to Figs 16 and 17 <strong>for</strong> <strong>the</strong> following<br />

description. First, we check to<br />

see if <strong>the</strong> AGC is turned on. If so, we<br />

increment AGCLoop, <strong>the</strong> counter <strong>for</strong><br />

AGC hang-time loops. Each pass<br />

through <strong>the</strong> code is equal to a hang time<br />

of 46 ms. PC SDR provides hang-time<br />

loop settings of 3 (fast, 132 ms), 5 (medium,<br />

230 ms), 7 (slow, 322 ms) and 22<br />

(long, 1.01 s). The hang-time setting is<br />

stored in <strong>the</strong> AGCHangvariable. Once<br />

<strong>the</strong> hang-time counte resets, <strong>the</strong> decay

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!