Pro-Kit

nt>
Below is a cache of http://www.invent-electronics.com/pdf_files/Frequency_Converter_Manual.pdf. It's a snapshot of the page taken as our search engine crawled the Web.
The web site itself may have changed. You can check the current page or check for previous versions at the Internet Archive. Yahoo! is not affiliated with the authors of this page or responsible for its content.
Pro-Kit










Actual Size of PC Board is:
1-7/8 X 2-7/8

T
est
equipment can really take
a huge bite out of the
experimenters budget, and the
more the current recession hits
home, the more that craved
collection of test gear seems to
drift into dreamland of future days
to come. A typical simple
frequency counter can run
anywhere between a hundred to
several hundred dollars. Well,
unplug your dream machine and
plug in your soldering iron because
the following article will show you
a very inexpensive approach to a
7-digit 50MHz frequency counter
using the new PIC16C5X series of
microcontrollers, manufactured by
Microchip. In additio n to
simplicity and low cost, this
microcontroller makes possible an
auto range, direct display feature
that is not even available on some
of the most expensive store bought
models. That is, the frequency is
displayed with the actual suitable
suffix (Hz, KHz or MHz) with
floating decimal point, instead of
the old "number as an exponent"
method. This makes for a
substantial improvement in the
readability of the frequency
displayed. Also, the gate time
automatically changes from 0.1 sec
to 1 sec at the low end of the
frequency range to allow
measurements with a resolution
down to 1 Hz. All this, using just a
couple ICs and a couple
transistors, linked to a display
module.

About The Circuit
A schematic diagram is shown
in figure 2. The signal being tested
is coupled through C1 to the
resistor network comprised of R1
and R2 which set the input
impedance to greater than 1
megohms. C2 improves the signal
gain at the higher frequencies, D1
and D2 clip those signals greater
than 1Vp-p. The signal is applied
to Q1 - an N-channel JFET
configured as a common-source
amplifier which is self-biased by
source resistor R4. The output
taken at Q1's drain is direct-
coupled to the PNP transistor Q2,
which is configured as a common-
emitter amplifier and whose output
is negatively fed back to the source
of Q1 through collector resistor
R5. This negative feedback helps
to flatten the frequency response
throughout the 50MHz bandwidth.
The 500-ohm trimmer
potentiometer (R3) sets the bias of
both Q1 and Q2, decoupling
capacitor (C4) further improves the
gain at the higher frequencies.
Note, that this input amplifying
stage (Q1, Q2) is powered by 9
volts as apposed to 5 volts which
powers the remaining part of the
circuit. This allows for greater
overall gain of the frequency
counter's front-end. The sensitivity
is about 100mVRMS from 100Hz
to 2MHz, increasing to about
800mVRMS at 50MHz. Although
this is slightly high at the upper
range, it is sufficient to capture and
read the frequency of most
transmitters and/or digital
oscillators, and allows for a simple
and low cost circuit. The output of
the Q1-Q2 amplifying stage is
coupled through C5 to the schmitt
trigger NAND gate (U2) which in
turn converts the signal to a 5-volt
square wave which can then be
processed by the microcontroller.
The voltage divider network
consisting of R6 and R7 holds the
input level of U2's pin 1 to the
midway point between its high and
low triggering thresholds. The
function of the four NAND gates
in U2 will be explained in a
moment.

Microcontroller
The heart of the circuit is the
microcontroller U1 (part no.
PIC16C54) - an EPROM-based 8-
bit CMOS microcontroller
manufactured by Microchip. A
CallSaver Corporation

Pro-Kit
931 W. Main St. Bridgeport, WV.26330





304-842-2472

50MHZ Auto-Range Frequency Counter






pre-programmed chip can be
obtained from the source
mentioned in the parts list. This
microcontroller has one 8-bit I/O
port and one 4-bit I/O port whose
pins are configured individually as
either an input or output at
different times during the
execution of its program which is
stored in 512 x 12 bits of internal
EPROM. The chip also contains 32
x 8 bits of RAM used as general
purpose registers in the execution
of its program. An RTCC (Real
Time Clock/Counter) input pin is
available on the chip together with
its own asynchronous ripple
counter prescaler. The prescaler is
completely independent of the
microcontrolle r's operating speed
and is what makes it possible to
count the pulses of a signal being
tested even though it may be at a
much higher frequency then that of
the microcontroller's clock. The
clock is set by a 4MHz crystal
(XTAL1), and trimmer capacitor
(C12) is used for final calibration
adjustments. The PIC16C5X series
of microcontrollers' instruction
time is equal to four clock pulses,
so with a 4MHz clock, one
instruction is executed every 1uS.
This makes for ease in getting the
exact gate times of 0.1 sec and 1
sec. The microcontroller starts the
count of the test signal by driving
bit-3 of port-A high which enables
U2-a. Also this logic level is
inverted by U2-d which is then
applied to and disables U2-c
(explained later). The output of
U2-a passes through U2-b and is
placed on the RTCC pin of the
microcontroller. The internal
prescaler assigned to the RTCC
pin counts the pulses and
automatically increments the
RTCC's main register every time
the prescaler reaches a full count
of 256. The microcontroller's
program is designed to watch the
RTCC register and increment an
additional register every time the
RTCC register rolls over. So in
effect you have three 8-bit
registers to store the count, a
maximum count being 16,777,215
or over 167 MHz when using a 0.1
sec gate. This is more then
adequate for our 50 MHz counter.
The programming loop that the
microcontroller is in when
performing this count function
terminates after an exact
predetermined time which is equal
to the gate time (0.1 sec or 1 sec),
then bit-3 of port-A is driven low
preventing any additional input
signal pulses from being applied to
the RTCC pin. After accumulating
the count for the duration of the
gate time, the RTCC's prescaler
holds the least significant 8 bits of
that number. In order to retrieve
this number the microcontroller
has to toggle the RTCC pin
externally while keeping a running
count of the cycles required to
force a rollover of the prescaler,
which is detected by an increment
of the main RTCC register. The
actual number is then derived by
using the two's compliment. As
mentioned earlier, U2-c was
disabled by the low from U2-d
while the microcontroller was in
the count mode. At the end of the
gate time however, bit-3 of port-A
was driven low. This low causes a
high at the output of U2-d enabling
U2-c. The microcontroller can then
toggle bit-2 of port-A and that
pulse will pass through U2-c and
U2-b to the RTCC pin. The three
8-bit registers that hold the count -
which represents the frequency of
the signal in test (hint: with a 0.1
sec gate time, the frequency is
found simply by moving the
decimal point one place to the
right) - must now be converted to a
binary coded decimal in order to
be displayed. This is done in a
complex subroutine which stores
the results in seven different 8-bit
registers, one for each digit in
decimal notation. The most
significant four bits of each
register is set to "0011", creating
the actual ASCII equivalent of
each decimal number, which can
then be sent to the display module.

LCD Display Module
DISP1 is a 1-line, 16-character
LCD display module which has its
own built in controller designed to
display both numbers and letters
by receiving the standard ASCII
code equivalent on its 8-bit port.
Data, including the ASCII codes,
are sent to the display via port-B of
the microcontroller (U1). The first
three bits of U1's port-A are used
as control lines for the display
(Data/Instruction, Read/Write and
Enable). Writing a character to the
display consists of first placing the
8-bit address (location for the
character on the display) on port-
B, setting the correct status on the
control lines while strobing the
enable line, then the actual ASCII
character code is placed on port-B,
while again strobing the enable
line with the correct status on the
control lines. U1 then changes
port-B to an input, the status lines
are set to read the busy flag from
DISP1 and U1 strobes the en