1 COMMON A, AL, B, BASEONLY, C, C$, C1, CAT$, CC, CKT$, D, D$, DD, DIA, DIMN$, DMS, E, EO, EX$, F, F$, FD, FF, FQ, FRQ, G$, GO$, I, I$, L, LATLONG, LD, LL, LN, LS, LW, LX, MAX, MENU, MIN, MX, N, NN, NT, OV, P, PI, PROG$, Q, QQ, QU, R, RA, RC, T, T$, U, U$, UH, UL$, V$, VC, W, WHIP, WIRD, WW, X, X$, X1, XS, Z$, ZP, ZS
10 'FILTRLC - FILTERS, R/L/C - 27 JUN 1998 rev.
20 IF EX$=""THEN EX$="EXIT"
30 CLS:KEY OFF
40 COLOR 7,0,1
50 PI=4*ATN(1)  '3.141593
60 UL$=STRING$(80,205)
70 '
80 '.....title page
90 CLS
100 COLOR 15,2
110 PRINT " FILTERS - PASSIVE R/L/C";TAB(57);"by George Murphy VE3ERP ";
120 COLOR 1,0:PRINT STRING$(80,223);
130 COLOR 7,0
140 '
150 '.....start
160 F=0:R=0:C=0:L=0
170 Y=3:X=1:GOSUB 1270
180 Y=3:X=21:GOSUB 1360
190 Y=3:X=41:GOSUB 1450
200 Y=3:X=61:GOSUB 1540
210 Y=8:X=13:GOSUB 1620
220 LOCATE 14
230 PRINT UL$;
240 PRINT " Press number in < > to select:"
250 PRINT UL$;
260 PRINT "   <1> RLC Low Pass"
270 PRINT "   <2> RLC High Pass"
280 PRINT "   <3> RLC Band Pass or Notch"
290 PRINT "   <4> RC Low Pass, High Pass and Notch"
300 PRINT
310 PRINT "   <0> EXIT"
320 Z$=INKEY$
330 IF Z$=""OR Z$<"0"OR Z$>"4"THEN 320
340 IF Z$="1"THEN 410
350 IF Z$="2"THEN 610
360 IF Z$="3"THEN 810
370 IF Z$="4"THEN 960
380 IF Z$="0"THEN CLS:RUN EX$
390 GOTO 320
400 '
410 '.....RLC low pass
420 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
430 Y=4:X=31:GOSUB 1270:LOCATE 9:PRINT UL$;
440 GOSUB 1060
450 IF F=0 AND R*L<>0 THEN F=R/(PI*L)
460 IF F=0 AND C*R<>0 THEN F=1/(PI*C*R)
470 IF F=0 AND L*C<>0 THEN F=1/(PI*SQR(L*C))
480 '
490 IF R=0 AND L*C<>0 THEN R=SQR(L/C):   GOTO 450
500 IF R=0 AND F*C<>0 THEN R=1/(PI*F*C): GOTO 450
510 IF R=0 AND L*F<>0 THEN R=PI*L*F:     GOTO 450
520 '
530 IF C=0 AND F*R<>0 THEN C=1/(PI*F*R): GOTO 450
540 IF C=0 AND L*R<>0 THEN C=L/R^2:      GOTO 450
550 '
560 IF L-0 AND R*C<>0 THEN L=R^2*C:      GOTO 450
570 IF L=0 AND R*F<>0 THEN L=R/(PI*F):   GOTO 450
580 IF F*R*C*L<>0 THEN 1180
590 GOTO 440
600 '
610 '.....RLC high pass
620 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
630 Y=4:X=31:GOSUB 1360:LOCATE 9:PRINT UL$;
640 GOSUB 1060
650 IF F=0 AND R*L<>0 THEN F=R/(4*PI*L)
660 IF F=0 AND C*R<>0 THEN F=1/(4*PI*C*R)
670 IF F=0 AND R*L<>0 THEN F=R/(4*PI*L)
680 '
690 IF R=0 AND L*C<>0 THEN R=SQR(L/C):     GOTO 650
700 IF R=0 AND F*C<>0 THEN R=1/(4*PI*F*C): GOTO 650
710 IF R=0 AND F*L<>0 THEN R=4*PI*F*L:     GOTO 650
720 '
730 IF C=0 AND L*R<>0 THEN C=L/R^2:        GOTO 650
740 IF C=0 AND F*R<>0 THEN C=1/(4*PI*F*R): GOTO 650
750 '
760 IF L=0 AND R*C<>0 THEN L=R^2*C:        GOTO 650
770 IF L=0 AND F*R<>0 THEN L=R/(4*PI*F):   GOTO 650
780 IF F*R*C*L<>0 THEN 1180
790 GOTO 640
800 '
810 '.....RLC band pass or notch
820 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
830 X=21:Y=3:GOSUB 1450
840 X=41:Y=3:GOSUB 1540
850 COLOR 0,7
860 LOCATE 8,13:PRINT " Use a value of R to suit requirements of your circuit."
870 COLOR 7,0
880 LOCATE 9:PRINT UL$;
890 GOSUB 1060
900 IF F=0 AND L*C<>0 THEN F=1/(2*PI*SQR(L*C))
910 IF C=0 AND L*F<>0 THEN C=1/(3.950000E+01*L*F^2)
920 IF L=0 AND C*F<>0 THEN L=1/(3.950000E+01*C*F^2)
930 IF F*R*C*L<>0 THEN 1180
940 GOTO 890
950 '
960 '.....RC filters
970 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
980 Y=3:X=13:GOSUB 1630:PRINT UL$;
990 GOSUB 1060
1000 IF F=0 AND R*C<>0 THEN F=1/(2*PI*R*C)
1010 IF R=0 AND F*C<>0 THEN R=1/(2*PI*F*C)
1020 IF C=0 AND F*R<>0 THEN C=1/(2*PI*F*R)
1030 IF F*R*C<>0 THEN 1180
1040 GOTO 990
1050 '
1060 '.....data input
1070 VIEW PRINT 10 TO 24:CLS:VIEW PRINT:LOCATE 10
1080 IF F THEN 1100
1090 INPUT " ENTER: F in MHz......( 0 if unknown )";F:F=F*10^6:IF F THEN 1160
1100 IF R THEN 1120
1110 INPUT " ENTER: R in ohms.....( 0 if unknown )";R:IF R THEN 1160
1120 IF C THEN 1140
1130 INPUT " ENTER: C in pF.......( 0 if unknown )";C:C=C/10^12:IF C THEN 1160
1140 IF Z$="4" OR L<>0 THEN 1160
1150 INPUT " ENTER: L in æH.......( 0 if unknown )";L:L=L/10^6:IF L THEN 1160
1160 RETURN
1170 '
1180 '.....printout
1190 VIEW PRINT 10 TO 24:CLS:VIEW PRINT:LOCATE 10
1200 T=33
1210 IF F THEN PRINT TAB(T);USING "F=##,###.### MHz";F/10^6
1220 IF R THEN PRINT TAB(T);USING "R=##,###.### ê";R
1230 IF C THEN PRINT TAB(T);USING "C=##,###.### pF";C*10^12
1240 IF L THEN PRINT TAB(T);USING "L=##,###.### æH";L*10^6
1250 GOTO 1740   'end
1260 '
1270 '.....RLC low pass
1280 COLOR 0,7:LOCATE Y
1290 LOCATE ,X:PRINT "  R/L/C Low Pass   "
1300 LOCATE ,X:PRINT " Ú¯ ÄÄLÄÄÂÄÂÄ ®¿   "
1310 LOCATE ,X:PRINT " Vin     C R  Vout "
1320 LOCATE ,X:PRINT " À¯ ÄÄÄÄÄÁÄÁÄ ®Ù   "
1330 COLOR 7,0
1340 RETURN
1350 '
1360 '.....RLC high pass
1370 COLOR 0,7:LOCATE Y
1380 LOCATE ,X:PRINT "  R/L/C High Pass  "
1390 LOCATE ,X:PRINT " Ú¯ ÄÄCÄÄÂÄÂÄ ®¿   "
1400 LOCATE ,X:PRINT " Vin     L R  Vout "
1410 LOCATE ,X:PRINT " À¯ ÄÄÄÄÄÁÄÁÄ ®Ù   "
1420 COLOR 7,0
1430 RETURN
1440 '
1450 '.....RLC band pass
1460 COLOR 0,7:LOCATE Y
1470 LOCATE ,X:PRINT "  R/L/C Band Pass  "
1480 LOCATE ,X:PRINT " Ú¯ ÄÄCÄÄLÄÂÄ ®¿   "
1490 LOCATE ,X:PRINT " Vin       R  Vout "
1500 LOCATE ,X:PRINT " À¯ ÄÄÄÄÄÄÄÁÄ ®Ù   "
1510 COLOR 7,0
1520 RETURN
1530 '
1540 '.....RLC notch
1550 COLOR 0,7:LOCATE Y
1560 LOCATE ,X:PRINT "   R/L/C Notch     "
1570 LOCATE ,X:PRINT " Ú¯ ÄÂÄLÄÂÄÂÄ ®¿   "
1580 LOCATE ,X:PRINT " Vin ÀÄCÄÙ R  Vout "
1590 LOCATE ,X:PRINT " À¯ ÄÄÄÄÄÄÄÁÄ ®Ù   "
1600 COLOR 7,0
1610 RETURN
1620 '
1630 '.....RC low/high/notch
1640 COLOR 0,7:LOCATE Y
1650 LOCATE ,X:PRINT "  R/C Low Pass  Û  R/C High Pass Û     R/C Notch       "
1660 LOCATE ,X:PRINT " Ú¯ ÄÄRÄÂÄ ®¿   Û Ú¯ ÄÄCÄÂÄ ®¿   Û Ú¯ ÄÂÄRÄÂÄRÄÂÄ ®¿   "
1670 LOCATE ,X:PRINT " Vin    C  Vout Û Vin    R  Vout Û ³   ³   ³   ³   ³   "
1680 LOCATE ,X:PRINT " À¯ ÄÄÄÄÁÄ ®Ù   Û À¯ ÄÄÄÄÁÄ ®Ù   Û Vin ÀÄCÄ³ÂCÄÙ  Vout "
1690 LOCATE ,X:PRINT "                Û                Û ³   Ú2xCÙÀRö2¿  ³   "
1700 LOCATE ,X:PRINT "                Û                Û À¯ ÄÁÄÄÄÄÄÄÄÄÁ ®Ù   "
1710 COLOR 7,0
1720 RETURN
1730 '
1740 '.....end
1750 PRINT UL$;
1760 PRINT "  (Ref. ";CHR$(34);;"Programs for Electronic Circuit Design";
1770 PRINT CHR$(34);;", Radio Shack Cat.No. 62-1054)"
1780 GOSUB 1820
1790 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
1800 GOTO 150
1810 '
1820 '.....PRT
1830 KEY OFF:GOSUB 1900:LOCATE 25,5:COLOR 0,2
1840 PRINT " Send this page to:(1)Printer Queue? (2)Printout? ";
1850 PRINT "(3)Next page? (1/2/3)";:COLOR 7,0
1860 Z$=INKEY$:IF Z$<"1"OR Z$>"3"THEN 1860 ELSE GOSUB 1900
1870 IF Z$="3"THEN RETURN
1880 FOR I%=1 TO 24:FOR J%=1 TO 80:LPRINT CHR$(SCREEN(I%,J%));:NEXT J%:NEXT I%
1890 IF Z$="2"THEN LPRINT CHR$(12) ELSE 1830
1900 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
