Documente Academic
Documente Profesional
Documente Cultură
Low-Cost 50MHz
Frequency Meter – Mk.2
By JOHN CLARKE
LCD readout
A 2-line 16-character liquid crystal
display (LCD) shows the frequency
reading. This has several advantages
over LED displays, including much
lower current consumption.
In addition, the LCD can show all
Fig.1: the block diagram of the 50MHz Frequency Meter for ‘normal’ frequency measurements. The incoming signal
is first amplified, then fed through a gating circuit to a clocking stage (IC2b). This then drives a divide-by-256
prescaler inside PIC microcontroller IC3 (ie, at the RA4 input).
Fig.2: this is the alternative configuration for making high-resolution (ie, to 0.1Hz) measurements below 150Hz. In
this case, the input signal is applied to the RA4 input as before. However, the prescaler is no longer clocked by the
RA4 input, but by an internal 1MHz clock instead.
During this period, the prescaler counts checked to see if its count has changed. For the Prescaler units selection, the
the incoming signal applied to RA4. Each If TMR0 hasn’t changed, then the pres- Hz units are shown as kHz, the kHz
time its count overflows from 255 to 0, caler is clocked again with RA3. units are shown as MHz and the MHz
it automatically clocks timer TMR0 by During this process, register C is de- units are shown as GHz.
one count. Similarly, whenever the timer creased by one each time the prescaler In the 10kHz rounding mode, fre-
output overflows from 255 to 0, it sets is clocked. The process continues, quencies above 16MHz are rounded up
a timer overflow interrupt flag (TOIF), with RA3 clocking the prescaler until to the next 10kHz band. For example,
which in turn clocks Register A. timer TMR0 changes by one count. a 36.44659MHz signal is rounded up
When this happens, it indicates that to 36.450MHz.
Prescaler value the prescaler has reached its maxi-
At the end of the gating period, IC3’s mum count. The value in Register C Alternative configuration
RB2 output is cleared, thus stopping will now be the value that was in the If the input signal frequency is greater
any further signal from passing through prescaler at the end of the counting than 16MHz, and the gating period is 1s,
to the prescaler. The value of the count period. register A will initially have overflowed.
in TMR0 is now transferred to Register The processing block now reads the In this case, the gating period is automat-
B. Unfortunately, the value in the pres- values in registers A, B and C. Based ically changed to 100ms. Alternatively,
caler cannot be directly read by IC3 and on this information, it then decides if the high-resolution mode is selected
so we need to derive the value. where to place the decimal point and and the frequency is below 150Hz, the
This is done by first presetting whether to show Hz, kHz or MHz. The frequency meter changes its configura-
register C with a count of 255. That required value is then written to the tion to that shown in Fig.2.
done, the RA3 output is taken low to LCD via the data and control lines (RB4 In this case, the input signal is
clock the prescaler and timer TMR0 is to RB7, and RA0 to RA2). applied to the RA4 input as before.
Fig.4: this is the layout to use to upgrade an existing Mk.1, Version 1 module.
Power supply
Power for the circuit is derived from
Fig.6: this is the layout to follow if you are building Version 3. either a 9V to 12V DC plugpack or a
7.5V battery, made up using five AA
cells. You can choose to operate from
through to the pin 3 output, but is So, in summary, the signal is allowed batteries or a DC supply – but not both.
inverted). Conversely, when RB2 is through to IC2b when RB2 is high, Diode D4 protects the circuit against
at 0V, IC2a’s pin 3 output remains and is blocked when RB2 is low, as reverse polarity protection when us-
high, and the input signal is blocked. described previously. ing a plugpack supply, while regulator
The LCD module is secured to the lid of the case using four M3 × 6mm cheesehead
screws, four M3 nuts and four M3 × 10mm tapped nylon spacers. Make sure that
all polarised parts on the counter board are correctly orientated.
REG1 provides a +5V supply rail to site, access via epemag.co.uk. Pre-
power the circuit. The specified volt- programmed PICs are available from
age regulator is a low dropout type, so Magenta Electronics – see their advert
that the meter will still operate when in this issue for contact details.
the batteries have dropped to 5V.
If a battery is used, it connects to the Construction
cathode (K) side of D4; ie, it bypasses The 50MHz Frequency Meter Mk.2
the reverse polarity protection. This can be made in one of three versions, dropout regulator. In addition, you
means that D4 can be left out of the depending on what display module will need to drill an extra hole in the
circuit (along with the DC socket) if you buy. That’s because different front panel to accommodate the ad-
the unit is to be battery powered. suppliers sell different LCD mod- ditional switch.
If you wish to use rechargeable cells, ules, so a different PC board has
then it is recommended that you use been designed to suit each module.
an extra cell to obtain more voltage. In These boards are coded 581 Version Table 2: Capacitor Codes
this case, you could replace D4 with 1, 582 Version 2 and 583 Version
a 157 1W resistor to enable charging. 3. (All available from the EPE PCB Value MF code EIA Code IEC Code
Make sure you get the polarity correct. Service.) 470nF 0.47MF 474 470n
If you are concerned about polarity, a If you are buying a kit, make sure 100nF 0.1MF 104 100n
Schottky diode (1N5819) could also be you get the updated version and not 10nF .01MF 103 10n
included in series with the resistor. the original version described in Sept
470pF NA 471 470p
’06. If you are modifying an existing
Software kit, you will need a new programmed 33pF NA 33 33p
The software files are available for PIC16F628A, a miniature SPDT tog- 22pF NA 22 22p
free download via the EPE Downloads gle switch and an LM2940CT-5 low