Resonant Circuit Design

Date: 1986
Type: Program
Platform(s): TS 2068

Calculates the missing value in an LC resonant circuit: enter two of frequency (MHz), inductance (uH) and capacitance (pF), leaving the unknown as 0, and the program supplies the third. It then moves on to winding the coil. Given the coil diameter and length in inches, it estimates the number of turns and the turns per inch, and picks the largest enamelled wire size, from #16 to #30, that will fit. Either stage can be repeated with new values.

The title screen reads "RESONANT CIRCUIT DESIGN By Lawrence G. Friedman Apr85" and "DEBUGGED BY Ronald Ginardi ©1986".

Program Analysis

Program Structure

  • Lines 30–80: title screen, PAUSE 120, then CLEAR.
  • Lines 90–200: L, C, F inputs and the resonance formulas F=1000/(2*PI*SQR(L*C)) and L=25330/(F^2*C) (or C=25330/(F^2*L)), in MHz, uH and pF.
  • Lines 210–370: coil design. The turn count comes from a Wheeler-style single-layer formula, and a ladder of IF tests on the turns per inch selects the gauge.
  • Lines 380–420: repeat the coil design with the same L, C and F, or start a new calculation.

Notable Techniques

  • The inductance is copied into Z before the program solves for whichever value is missing, so the coil section always has an inductance to work with.
  • The cascade of IF W<… tests, each overwriting C$, leaves the largest gauge that fits without needing ELSE.

Potential Issues

  • Line 280 jumps to line 370 when the turns per inch exceed 80.5, but C$ has not been set after the CLEAR at line 80. The program stops with "Variable not found", or on a repeat pass prints the previous wire size. A value of exactly 80.5 also leaves C$ unset.
  • Line 250 computes SQR(Z*(9*D+10*G)/D), with the radius inside the square root. Wheeler’s formula gives SQR(Z*(9*D+10*G))/D, so the turn count appears to be off except for a 2-inch coil.
  • Nothing checks that exactly one of F, L and C was left at 0.

This program comes from a Larken disk in the TS User Group collection. For tape, the LKDOS prefix in the save line was removed. It was tested in ZEsarUX.

Image Gallery

Source Code

   10 GO TO 30
   20 PRINT #4: SAVE "resckt.Ba"
   30 CLS 
   40 PRINT "RESONANT CIRCUIT DESIGN"
   50 PRINT "By Lawrence G. Friedman Apr85 RE"
   60 PRINT ''"DEBUGGED BY Ronald Ginardi *1986"
   70 PAUSE 120
   80 CLS : CLEAR 
   90 PRINT "CALCULATION OF L, C, OR F"''
  100 INPUT "ENTER F IN MHz ";F
  110 IF F<>0 THEN PRINT "F= ";F;" MHz"
  120 INPUT "ENTER L IN uH ";L
  130 IF L<>0 THEN PRINT "L= ";L;" uH"
  140 INPUT "ENTER C IN pF ";c
  150 IF C<>0 THEN PRINT "C= ";C;" pF"
  160 IF F=0 THEN PRINT "F= ";: LET F=1000/(2*PI*SQR (L*C)): PRINT F;" MHz"
  170 IF L=0 THEN LET Z=25330/((F^2)*C)
  180 IF L<>0 THEN LET Z=L
  190 IF L=0 THEN PRINT "L= ";: LET L=25330/((F^2)*C): PRINT L;" uH"
  200 IF C=0 THEN PRINT "C= ";: LET C=25330/((F^2)*L): PRINT C;" pF"
  210 PRINT '"COIL PARAMETERS"
  220 INPUT "ENTER COIL DIAM. IN INCHES ";D
  230 PRINT "DIAM = ";D;" in": LET D=D/2
  240 INPUT "ENTER COIL LENGTH IN INCHES ";G: PRINT "LENGTH = ";G;"in"
  250 LET T=SQR ((Z*((9*D)+(10*G)))/D)
  260 PRINT T;" turns"
  270 LET W=T/G
  280 IF W>80.5 THEN PRINT '"WIRE SIZE IS LESS THAT #30      PLEASE TRY ANOTHER CONFIGURATION": GO TO 370
  290 IF W<80.5 THEN LET C$="#30"
  300 IF W<72.7 THEN LET C$="#28"
  310 IF W<50 THEN LET C$="#26"
  320 IF W<46.3 THEN LET C$="#24"
  330 IF W<37 THEN LET C$="#22"
  340 IF W<29.4 THEN LET C$="#20"
  350 IF W<23.6 THEN LET C$="#18"
  360 IF W<18.9 THEN LET C$="#16"
  370 PRINT C$;" IS THE LARGEST WIRE SIZE"
  380 INPUT "REPEAT PARAMETER DESIGN (Y/N)? ";R$
  390 IF R$="Y" OR R$="y" THEN CLS : PRINT "F= ";F;" MHz"'"C= ";C;" pF"'"L= ";L;" uH"': GO TO 210
  400 INPUT "REPEAT L,C,F CALCULATION (Y/N)? ";R$
  410 IF R$="Y" OR R$="y" THEN GO TO 80
  420 STOP

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