Sunteți pe pagina 1din 4

I

1 GHz FREQUENCY METER CARD


FOR PCs

H. Kolter

This plug-in card for IBM PC-XT/AT and compatibles forms a


cost-efficient alternative to a stand-alone frequency meter. Simple to
build and program, the card has a TIL input as weil as a prescaler
input with high sensitivity that can handle frequencies up to 1 GHz.

The signals on the expansion slots of an isters and one control register contained counters are cleared by areset pulse of
IBM PC or compatible machine form the in the 8255 PPl. accurately defined length, genera ted with
starting point for the design of any exten- the aid of a programmed port line and a
sion card for this type of computer. The monostable multivibrator.
Frequency measurement
hardware that arranges the data flow and
addressing must be laid out carefully to Frequency measurement almost invari-
ably requires a counter and a reference
Ports and peripherals
meet the technical requirements drawn up
du ring the design stages. In practice, the dock oscillator. Here, the latter function is The 8255 is probably the best known pro-
eight bidirectional datalines between the realized by a 4 MHz osci11ator block con- grammable 1/0 device designed for use
extension card and the motherboard must trolled by an on-board quartz crystal. This with Intel microprocessors. lt provides 24
be buffered to prevent the drive capacity device comes in an encapsulated meta! 1/0 pins which may be individually pro-
of the CPU and associated peripheral enclosure with pins that fit into an Ie grammed in two groups of 12, and used in
chips being exceeded at the rtsk of perma- socket. The output signal of the oscillator one of three modes of operation. The con-
nent damage to the computer. The next block is applied to a d ivider circuit com- tent of the control register on board the
requirement is that the extension circuit posed of individual, cascaded counter 8255 determines w hether the port lines
must occupy a carefully selected address les. The output pulses of the last counter function as an input or an output. In
range that can be accessed by the CPU in are applied to a NOR gate, the seeond Mode 0, eaeh group of 121/0 pins may be
aeeordanee with the 1/0 (input/output) input of which is driven by the measured progremmed in sets of four to be input or
map defined by IBM. Henee, the address signal. The outpur signal of the NOR gate output. In Mode 1, eaeh group may be
range occupied by the extension card docks a counter cascade for the duration programrned to have 8 Jines of input or
must be unique in the computer system to of the gate time. When the gate time is output. Of the remaining four pins. three
avoid 1/0 contention problems. over, the counter state - which is propor- are used for handshaking and interrupt
The frequency meter card presented tional to the frequency of the measured control signals. The third mode of oper-
here has a Type 8255 PPl (Programmable signal - is taken over by one of the PPI ation, Mode 2, is a bidirectional bus mode
Peripheral Interface) to meet the above ports. which transfers it to the Cf'U. A that uses 8 lines for a bidirectional bus.
requirements as regards buffering and ad- small BASIC program translates the and 5 lines for handshaking, borrowing
dress decoding. All control of counter and counter state into the corresponding fre- one from the other group.
clock circuits on the extension card is ar- quency, which is shown on the monitor. The 8255 on the frequency meter card,
ranged by the Cf'U via the three da ta reg- Before the next measurement cycle, a11 IC1, operates in Mode 0 with all port lines
ELEKTOR ELECTRONICS JANUARY 1990
1 GHz FREQUENCY METER CARD FOR PCs
I
.3
SV sv
lBM~ot G)
+
sv 29B
3. N1 = IC3 = 74LSJO
N2•.•N7 = le4 -= 74LS04
C~
--Y.- ,,[~ NB...Nl1 = les = 74lS00

e
L
=
:J!OO. ~ J--0 ,,1 ---!!,,!!,-,I
",.-!J. "-' J J ~v
N12
=
1/. ics = 74LS32
ES 1 1/41CB = 4056
N13 -= '41C15 = 74LS02
,. ..:..0 +

.. = = 74HCTQ4
2AtA N14 ... N17 2/3 IC16
1881..1.. 0 AI 2

"
D6
3. 11 82 A2. 3 28 06
27 01 P8Q~'~B~±~3
PBt 19tce 4 IOA IC14 0 14

0' ,. 16 83 IC2 A3 4
29 05 P82 20 5 lOG IR ~''--+-_'' __ ;J;:=~-"13
0.
03
0' ..,.
,.
6'
15S4
14 85
13S6
12 87
74
LS
245
AAS
A5 6
A67
Al B
3004
31 03
32 02
33 01
PR321
PB-' 22
P8S 23
PBS 24
6'00
11 20A 74
10 206 Her
9 20e 393
2fI~
t,"e
+
r-
5V 9
00 ';'2'

IC9
0'
00 Ha8
G
DIRAB 9
,
3400 PB725 8200 ..I..~
"
HL

• IC1
~
,---" ... 4040

N2 .....L........,"";;r-:........J
PCQ 14 9 00 CU<.
" t

N12 :~!~:~:~~:~7
PC4'3~: Jj 304 ~
ct.e 011 ';'2'2

, , ecs
ece 12
11
2 QS
4 06
IC12 ',,--J:------'in"
",~1t
IC10

". ... 4040

". " ,
36 WR PC7J.!Q-
".0 4
"
PA! 3
13
07
1208
4040
... h ~ CU<
N8
PA2. 2
PA3 '
14 09
IS 0'0 ~
L 0
':
200"'2
a
B ,
• N9
e
,,::"0 ~ ~5V t-_---<~_'l2
L...!.2
IR lC13
2R
3
.,
~~--e
6,oO 74
12 13
.. ,,~3"''--I_-'l'00
Cl' +
d 132A HCl e B

e
.J:-' ...
NIO 0
Nll 0 l 393
PA& 38 7 01 16
,.
'7
"
PAl3? 602
IC11R~'"-'--~
, ,.!!L...
,
IC17
U6060
...
11 f-i~,
C3
In mOn
Q
.,
AO
,
c: ~" • "'I~J
4040 5V+,~
,
Al
"'"
_1!'~B'~~3!J1
')
_1',,,,7'~~''i~''''''
6N4 3
4 N3 l-'
2

L...----'
""h sv
ES1

(+) .1.
_1"~"~~'~1~IONS 6~
k N1
6
CS
ct
::'" ..f!.!.- 5V
,ol'IUI"lr~
_~'~"~~''i312N6 5
A6

V "
'B
., ",
"
1 10 '"
C
11
RC
14
0 ~
IC3
". {»ö-N7 IC7
74121
0'
tc
IC4 ICB lC15
IC5 IC16
,. 16 IC6

'T
..., 11 12
cpcpcp-
WAu 894110-1~
L __ -' ta

Fig. 1_ Circuit diagram of the ptuq-In frequency meter card: the key components are the PPI,IC1, and the prescaler, IC17_

switched to inputs. Port C forms an excep- the ports and the control register in the at pin QO. Pin 2 01 gate NI3 is held low
tion, because one of its Iines functions 8255. until counter state 28x212x21 is reached.
briefly as an output to supply the reset The measured signal taken from connec-
pulse for the counter cascade. The remain- Circuit details tor K2or the prescaler (IC17)is applied to
ing pins of the 8255 are used to ensure the second counter cascade, IC14-ICI2-ICII,
correct interfacing with the CPU in the The input of counter cascade IC13-TC10-TC9via gate NI3. When the gate time (0.262 5)
computer. PPI input pins WR (write) and is clocked by 4 MHz crystal oscilla tor has lapsed, pin 2 01 N13 goes high. This
RU (read) are driven direct by the PC ex- block Xr. The counters are reset at power- results in ES] being opened, so that the
pansion bus IOW (input/output write) on, so that output QO of TC9is low. This rneasured signal is no longer processed.
and IOR (input/output read) signals that level is inverted by N 15, and electronic Next, the CPU reads the dataword (bit-
control the data direction. The 8255 is en- switch ESl Is consequently closed. The combination) provided by ports A, Band
abled by a low level at its es (chip select) clock pulses are counted by IC\3, a Type C 01 the PPI at adresses 300H, 30IH and
input. The es signal is supplied by ad- 74HCT393 set to a divisor of 28_ Its output 302H (768, 769 and 770 decimal). The
dress decoder Nt. pulses clock ICIO,which is configured to counter state of TCll,ICu and IC14is taken
PPI inputs PORT SELECT 0 (AO) and divide by 212. Counter IC9, Hnally. pro- over as a 23-bit word for further process-
PORT SELECT I (Al), together with in- vides a divisor of 21, and supplies an out- ing. Aseries of BASIC commands (from
puts RD and WR, control the selection of put signal with aperiod of about 0.524 s line 910 onwards in the control program)
ELEKTOR ELECTRONICS JANUARY 1990
I TEST AND MEASUREMENT

,cs

• • • •

"

1
a1R2 D

cs

• •L:::="--...

Fig. 2. Component overlay 01 the double-sided, through-plated printed circuit board. The pe slot eontaets are gold-plated.

Parts list

10 CLS; BEEP; KEY OFF


20 GATETIME:=.262144: FACTOR=l: B$="Hz"
Resistors: 30 GOSUB 460: REM start first measurement (also initialises PPI 8255>
40 PRINT h ********************************** •• **** ••• *****.*******~'***"
Rl = 6k8 50 PRINT" ec FREQUENCY METER ELEKTOR ELECTRONICS **"
R2=1k5 60 PRINT" * "*" •• "'.". ******** ****** ****"". ** **" •••• cO •• " ** **. ****" ** ** *. *"
70 LOCATE 23,1
R3=3300 80 PRINT" H => Hz K -=> kl+z M -=> MHz R => RANGE Q => QUIT"
R4= 750 90 REM TTL -------------------------------------------------------------------
100 LOCATE 5,8: I?RINT"RANGE 1: 4 Hz - 32 MHz.-(+/- 4 Hz)
R,= 4k7 110 LOCATE 7,8: PRINT"SWITCH TO LOWER INPUT SOCKET (TTL-input)"
Rs= lOOk 120 PRESCALER-=1
130 GOSUB 350: REH measurement
140 GOSUB 280: REM operation
CBpacHors: 150 IF A$="R" OR A$="r" THEN BEEP: GOTO IBO
160 GOTO 130
CI = 1~0; 10 V; radial 170 REM HF -------------------------------------------------------------------
C2;C3= lnO 180 LOCATE 5,8: PRINT"RANGE 2: 30 MHz - 1 GHz (+/- 1 kHz) "
190 LOCATE 7,8: I?RINT"SWITCH TO UPPER INPUT SOCKET (RF-input) "
C.;C,;Cs = 100n 200 I?RESCALER=256
210 GOSUB 350: REM measurement
220 GOSUB 280: REM operation
Semlconductors: 230 IF A$="R" OR A$="r" THEN BEEP: GOTO 100
01 = LEO (5 mm) 240 GOTO 210
250 REM leave program --------------------------------------------------------
IC, = 82555AC-2 260 CLS: KEY ON: END
IC2 = 74LS245 270 REM operation subroutine -------------------------------------------------
280 A$=INKEY$
IC3= 74LS30 290 IE' A$"'''Q''OR A$="q" THEN GOTO 260
1C4= 74LS04 300 IE' A$="H" OR A$="hn THEU FACTOR=l: B$="Hz"
310 IE' A$="K" OR A$="k" THEN FACTOR=1000!: B$="kHz"
IC, = 74LSOO 320 IF A$="M" OR A$="m" THEU FACTOR=1000000!: B$="MHz"
ICo = 74LS32 330 RETURN
340 REH measurement 3ubroutine -----------------------------------------------
IC7= 74121 350 WHILE TIMER<MITV: WEND: REM wait for measurement interval to 1apse
IC, = 4066 360 A~INP (768)
370 B""INP(769)
ICo;IC10;ICl1 ;ICI2 = 4040 380 C=INP (7701
ICI3;IC,. = 74HCT393 390 GOSUB 460: REM start next measurement
400 c=c AND &H7F: REM mask bit 1 on port C
IC" = 74LS02 410 COUNT-=32768!*A+256*C+B: REM use bytes read to ca1culate counter state
IC,s = 74HCT04 420 F=COUNT*PRESCALER!(GATETlME*FACTOR)
430 LOCATE 13,8: PRINT"FREQUENCY IN ";B$;" = ";INT(F+.5);"
IC'7 = U6060B (Telefunken) -44 0 RETURN
450 REH start next measurement
460 OUT 771,147
Miscellaneous: 470 OUT 770,128
81 ""miniature SPOT switch for pe8 rrcunt- 480 OUT 770,0
490 OUT 771,155
ing. 500 MITV=TIMER+.S
X, = 4 MHz oscillator block, 510 RETURN: REM --------------------------------------------------------------
K,;K2 = RCA (phono) socket tor PCB mount-
894110·15
ing.
PCB Type 894110 (see Readers Services
page).
Fig. 3. Listing of the GWBASIC program that controls the frequency meter card.

ELEKTOR ELECTRONICS JANUARY 1990


( d§oript""'"
measuremenl
commands
in measurement
measurement
procedure in
1 GHz FREQUENCY METER CARD FOR PCs

then takes effect. Port e is briefly


switched to outpur and supplies data-
I
principle procedure GWBA51C ward FFH(255 decirnal). The leading edge
of ehe signal at pin PC7 rrtggers mono-
1 1 stable multivibrator JC7, wh ich responds
by resetting a11counters by means of its
initialize PPI
betcre measurement
write value
93HEX (=147DEC)
outpur signal at pin 6. A counter state of 0
(lines PC4 10 PC7
golow
10 contr04
OUT (771,147) results i.n a low level at the Input of NIS.
3Q3H~~!:~~bEC)
automatically) Also, ESl is closed, so that the eircuit is
ready for a new measurement eyde.
1 ! The fact that the Cl'U starts every
measurement eyeIe by making pe7 high
write vaJu.e
80HEX (=1280EC) already indieates that it has ample time to
milke 110 line
PC710gic high !fgr~
302HEX (=7700ECl
OUT (770,128)
read the port contents, ealculate the fre-
quency, and update the screen. Moreover,
the clock oseillator is automatically d is-
1 abled after the gate time. Not surprising-
ly, therefore, the speed offered by BASIC
wrile 0 is ample for the control program.
treke VO line ~m&- OUT (770,0)
7Logic low
302HEX (=7700EC) The 1 GHz prescaler, ICll, is a Type
U6060 fram Telefunken, originally de-

1 !
signed for use in PLL-controlled TV tu-
ners. The chlp has a balaneed input (wh ich
is not used here), a fixed divide-by-256
wrIte 9BHEX
eeset PC4 10 PC7
(",115DEC)to
10 Inpt!ts for
reading control OUT (771,155) prescaler, and a TfL output level conver-
register at
measured
values adress 303HEX ter. The input sensitivity of the 50 Q input
(=771DEC)
is better than 20 rnV for frequencies be-

1 tween 30 MHz and 1,000 MHz.

WaltO.5e wait 0.55


X=TIMER
WHILE TIMER.X
+ 0,5 Addresses
Ior reading WEND
10 compleie An address decoder set up around JC3, JC4
and ICs monitors the logic levels on ex-
1 1 pansion bus address lines A3 through A9.
The es input of the 8255 Is actuated only
when A3 through A6 are low, and A8 and
read port A read adress
300HEX f=768DEC)
A=INP(768) A9 are high, in combination with the AEN
(address enable) line. When the 8255 Is
enabIed, one of its four registers is se-
1 1 Jected by the bit combinations on AOand
Al. This means that the frequency meter
read adreee
card occupies the four 1/0 addresses,
read port B B:=INP(769)
301HEX (=7690EC) 300H thraugh 303H, provided for pro to-
typing cards in the PC. If any other exten-
sion card in the pe occupies the same
1 1 addresses, it must be relocated by altering
its jumper configuration as specified by
read port C read aeeee C:=INP(770)
the manufacturer. In general, extension
302HEX (=7700EC)
cards can not share 1/0 address space
without causing bus contention problems.

1 .... 01
Software
The operation of the BASIC control pro-
rroe:JGt'ements measurement
"'~n gram for the frequency meter may be ana-
lyzed in three ways as shown by the
894110 ·16A respeetive flow diagrams in Fig. 4. The
BASIC pragram itself (Fig. 3) is straight-
eontrof· (~gf.t
.. '" UHE ...X ~ 1410~DC conl.ol· '.gl".,,, iBH[X" 155DEC
forward, oHering a kind of minimum user
PAl·PAn

1255 ...

{ · pCl·pe.
IHSA
. PA1.PAO

PCT.pe.
interface. The program is simply typed in
under GWBASIC (available on any
07.00

· PCl.PCO
DT·DO
{ •
MS/DOS PC), saved to disk, and starred
with the RUN command. LED DI flashes
..
PCl·PCO

a
• P61.P60
• P8,.PBO during rneasurements to indicate aetivity

-- _._.
of the eard. The program prompts you to
89400'168
select between the LF/ITL Input and the
~
~
zea _. HF input, and automatically switches be-
tween kHz and MHz readings on the
~ ~,
~ sca
m eca
_.
_0
screen.

Fig. 4. Flow-charts of the control program, and functional representation of the PPI in the
address space it occupies in the pe.

ELEKTOR ELECTRONICS JANUARY 1990

S-ar putea să vă placă și