Septmber
2005, Issue 182
Signal
Generation Solution
Build
an Inexpensive RF Signal Generator
CONTROLLER
MODULE
The
controller module is shown in Figure 5. I implemented
this controller on a Microchip PICDEM 2 Plus demonstration
board. The schematic shows only the portion of the demonstration
board that I used. I used the prototype area to add
the circuitry for controlling the RF module. The additional
8- and 20-V power supply designs are included in the
schematic for completeness, but bench supplies were
used for the prototype. Photo 1b shows the modified
demonstration board attached to the RF module in its
RF tight enclosure.
The
controller includes a Microchip PIC16F877A microcontroller
running at 4 MHz. The MCU’s job is light in this application,
so its limited amount of horsepower didn’t matter too
much.
As
you can see in Figure 5, I included a two-channel MCP4922
DAC to supply the control voltages to the RF POS-2000A
VCO and for the gain control to the AD8367. The DAC’s
outputs were buffered using the TLE2142 low-noise op-amp.
I initially attempted to use the PIC16F877A’s built-in
PWMs with low-pass filtering to produce the control
voltages, but I wasn’t happy with the output’s purity.
It turns out that the VCO and variable gain amplifier
are extremely responsive to fluctuations on these control
lines. The buffered DAC with the associated MCP1541
reference source perform quite well. They provide clean,
stable signals to the control lines.
|

(Click
here to enlarge)
|
Figure
5—The controller provides the analog voltages for
RF frequency control and IF signal amplifier gain.
The measurement of the actual RF and LO frequencies
is also performed in the controller. |
The
LO and RF frequency measurements are made in a unique
way. The challenge is to measure a signal that’s at
approximately 30 MHz with a microprocessor running at
4 MHz. This design uses the PIC16F877A’s internal Timer0
with a built-in prescaler. The prescaler is specified
at 10-ns rise and fall times, which enable it to be
clocked by an external source at up to 50 MHz. I gated
the input to Timer0 for 1 ms and then used Timer0’s
contents to calculate the frequency.
The
process seems pretty straightforward, but there was
a problem. Timer0 with its prescaler is 16 bits long,
but the microprocessor can read only the top 8 bits.
To determine the prescaler’s contents, I used the microprocessor
to pulse Timer0 until the prescaler overflowed into
the upper 8 bits of Timer0. The number of times you
have to pulse to get to overflow enables you to identify
the prescaler’s initial content. The PBasic pseudo code
used to execute this is shown in Listing
1 (p. 20). A simple flowchart is posted on the FTP
site.
A
standard LCD and two push buttons are included. I tried
to keep the interface simple, so the only controls are
an Up/Down frequency button. In response to a request
to change the frequency, the microprocessor will increase
or decrease the control voltage to the RF VCO. The output
frequencies of the RF and LO VCOs are then measured
in the aforementioned fashion, and the IF output frequency
is calculated. Following this, the microprocessor adjusts
variable gain amplifier’s gain as a function of frequency.
The microprocessor then displays the IF output frequency
on the LCD.