Calculating the Resonant Frequency of a Tuned Circuit Using the ZX81

Author(s): J. T. Beaumont
Publication: LISTing Newsletter
Date: September 1996
Pages: 9

This simple program for the ZX81 described below, will calculate the resonant frequency of a tuned circuit from known values of inductance and capacitance, or calculate the value of an inductor or a capacitor in order to resonate a tuned circuit at a required frequency — useful when designing oscillators and traps.

The program is based on the formula:

F = 1/2π√LC

which works for both series and parallel resonant circuits.

Using the Program

RUN the program and in response to the input prompts, type in the data. The program is self-explanatory asking you to input appropriate data.

An inductance of 250µH is to be connected in parallel with a variable capacitor of maximum value 160pF and minimum value 40pF. What is the tuning range of the circuit? Use the program to find out.

In addition to using the program for designing series-resonant circuits (acceptor circuits) and parallel tuned circuits (rejector circuits), it should be an asset to students studying for the RAE when checking their answers to calculations.

   5 REM **TO START PRESS "RUN"*
10 PRINT "[illegible]: A TUNED [illegible] [illegible] "
12 PRINT
13 PRINT
20 PRINT "DO YOU WANT TO CALCULATE THE INDUCTANCE? (YES/NO)"
21 INPUT A$
22 PRINT
23 IF A$="YES" THEN GOTO 49
24 PRINT "DO YOU WANT TO CALCULATE THE CAPACITANCE? (YES/NO)"
25 INPUT B$
26 IF B$="YES" THEN GOTO 1000
27 PRINT
28 PRINT "DO YOU WANT TO CALCULATE THE FREQUENCY? (YES/NO)"
34 INPUT C$
35 IF C$="YES" THEN GOTO 2000
40 CLS
48 IF C$="NO" THEN GOTO 20
49 CLS
50 PRINT """TO CALCULATE THE INDUCTANCE IN MICRO HENRIES"""
51 PRINT
80 PRINT "INPUT FREQUENCY ""IN MHZ."""
100 INPUT F
120 PRINT "FREQ IS ";F;" MHZ."
132 LET F=F*10**6
133 LET F=F**2
135 PRINT
140 PRINT "INPUT VALUE OF CAPACITANCE IN PF ";
150 INPUT C
160 PRINT "CAPACITANCE IS ";C;" PF."
180 LET C=C*10**-12
200 LET A=4*(PI**2)
250 LET X=A*F*C
260 LET L=1/X
270 PRINT
290 PRINT
295 LET Z=L*10**6
296 LET Z=INT (Z*10+.5)/10
297 IF Z<=0 THEN GOTO 1480
298 PRINT "I[illegible]ANCE I[illegible]. ";Z;" MICRO-HENRY"
320 GOTO 3160
1000 CLS
1012 PRINT
1020 PRINT """TO CALCULATE THE CAPACITANCE"""
1025 PRINT
1030 PRINT "INPUT FREQUENCY ""IN MHZ,"""
1100 INPUT F
1120 PRINT "FREQ IS ";F;" MHZ."
1132 LET F=F*10**6
1133 LET F=F**2
1135 PRINT
1140 PRINT "INPUT VALUE OF INDUCTANCE IN UH ";
1150 INPUT L
1160 PRINT "INDUCTANCE IS ";L;" UH."
1180 LET L=L*10**-6
1200 LET A=4*(PI**2)
1250 LET X=A*F*L
1260 LET C=1/X
1270 PRINT
1295 LET Z=C*10**6
1400 PRINT
1410 LET Z=C*10**12
1450 LET Z=INT (Z*10+.5)/10
1480 IF Z<=0 THEN PRINT AT 15,8;"[illegible]"
1485 IF Z<=0 THEN GOTO 3160
1500 PRINT "[illegible] ";Z;" PF"
1600 GOTO 3160
2000 CLS
2050 PRINT "TO CALCULATE THE FREQUENCY OF A TUNED CIRCUIT"
2052 PRINT
2060 PRINT "INPUT VALUE OF CAPACITOR PF."
2065 INPUT C
2075 PRINT "CAPACITANCE ";C;"PF."
2080 LET C=C*10**-12
2088 PRINT
2090 PRINT "INPUT INDUCTANCE IN MICRO HENRY"
2100 INPUT L
2200 PRINT "INDUCTANCE ";L;" UH."
2300 LET L=L*10**-6
2400 LET A=4*(PI**2)
2500 LET X=C*L*A
2600 LET Z=1/X
2700 LET F=SQR Z
2725 LET F=F/10**6
2730 LET F=INT (F*1000+.5)/1000
2750 PRINT
2800 PRINT "[illegible] ";F;" MHZ"
3160 PRINT AT 18,2;"""TO RETURN TO START"" ""[illegible]"""
3165 PRINT AT 20,7;"THEN NEWLINE."
3170 INPUT X$
3175 IF X$="X" THEN CLS
3180 GOTO 20
Resonant frequency program listing (ZX81 printout)
Resonant frequency program listing (ZX81 printout)

Transcription note: 0 and 8 look alike on this copy. Line 1480 and its AT 15,8 are typed on the likelier reading.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.