10 'COPYRIGHT F1HDD/ON1RG GHISLAIN RUY 1992 20 'FREE FOR NON COMMERCIAL USE 30 'FILTER STRUCTURE 40 '---||------------||---NEXT // LC AND SERIAL C 50 ' | | 55 ' | | 56 ' ___ ) 57 ' ___ ( 58 ' | ) 59 ' | ( 60 ' | | 61 ' ___ ___ 62 ' /// /// 70 ' 80 ' 90 pi = ATN(1) * 4 100 DEF FNcoth (x) = (EXP(x) + EXP(-x)) / (EXP(x) - EXP(-x)) 110 DEF FNsinh (x) = .5 * (EXP(x) - EXP(-x)) 120 DEF FNcosh (x) = .5 * (EXP(x) + EXP(-x)) 130 DEF FNasn (x) = ATN(x / SQR(ABS(1 - x * x))) 140 DEF FNacs (x) = ATN(SQR(ABS(1 - x * x)) / x) + pi * (1 AND (x < 0)) 'PRINT FNacs(-.5) * 180 / pi 900 GOTO 5000 1000 'generates max flat elts values 1010 'n is the filter order, w'1 is specified at -3dB, g0=1 1020 DIM g(n + 1) 1030 ' 1040 g(0) = 1 1050 FOR k = 1 TO n 1060 g(k) = 2 * SIN((2 * k - 1) * pi / 2 / n) 1070 NEXT k 1080 g(n + 1) = 1 1090 RETURN 1100 ' 1110 'computes attenuation for max flat 1120 'w'1 is -3dB frequency of lox pass proto 1130 'wc is the frequency of interest normalized to cut off frequency 1140 la = 10 * LOG(1 + .995262315# * wc ^ (2 * n)) / LOG(10) 1150 RETURN 2000 ' 2005 'generates tcheb. elts values 2010 'n is the filter order, w'1 is the equal ripple pass band 2015 'lar is the ripple value 2020 DIM g(n + 1) 2030 g(0) = 1 2040 x = lar / 17.37: beta = LOG(FNcoth(x)) 2050 x = beta / 2 / n: gamma = FNsinh(x) 2060 DIM a(n), b(n) 2070 FOR k = 1 TO n 2080 a(k) = SIN((2 * k - 1) * pi / 2 / n) 2090 b(k) = gamma ^ 2 + SIN(k * pi / n) ^ 2 2100 NEXT 2110 g(1) = 2 * a(1) / gamma 2120 FOR k = 2 TO n 2130 g(k) = 4 * a(k - 1) * a(k) / b(k - 1) / g(k - 1) 2140 NEXT 2150 IF 2 * FIX(n / 2) = n THEN x = beta / 4: g(n + 1) = (FNcoth(x)) ^ 2: GOTO 2165 2160 g(n + 1) = 1 2165 x = SQR(1 / eps): x = LOG(x + SQR(x ^ 2 + 1)) / n: d = FNsinh(x) 2167 delta = 1 / g(0) / g(1) 2170 e = d - 2 * delta * SIN(pi / 2 / n) 2173 x = n * LOG(e + SQR(e ^ 2 + 1)): num = FNcosh(x) 2175 x = n * LOG(d + SQR(d ^ 2 + 1)): den = FNcosh(x) 2180 tomax = ABS(num / den) 2190 RETURN 2200 ' 2210 'computes attenuation for tcheb;w1 is the ripple max frequency 2220 'wc is the frequency of interest normalised to ripple max frequency 2230 eps = 10 ^ (lar / 10) - 1: IF wc < 1 THEN 2240 ELSE 2250 2240 la = 10 * LOG(1 + eps * COS(n * FNacs(wc)) ^ 2) / LOG(10) 2245 GOTO 2260 2250 x = n * LOG(wc + SQR(wc ^ 2 - 1)): la = 10 * LOG(1 + eps * FNcosh(x) ^ 2) / LOG(10) 2260 la = FIX(10 * la + .5) / 10 2270 RETURN ' ' ' 5000 'computes values for lumped elts filter 5010 'pull required params :ripple, #poles, load impedance, center frequency and limits CLS 5015 PRINT "INPUT LOW AND HIGH FREQUENCY OF RIPPLE PASSBAND (TCHEB) OR AT -3dB FOR MAX FLAT" 5020 INPUT "Lowest frequency of pass band (MHz)"; f1 5030 INPUT "Highest frequency of pass band (MHz)"; f2: bp = f2 - f1 5040 INPUT "Number of poles "; n 5050 INPUT "Ripple "; lar 5060 INPUT "Input impedance "; za: ga = 1 / za 5070 INPUT "Output impedance "; zb: gb = 1 / zb 5075 INPUT "dil"; dil 5080 ' 5090 ' PRINT "print screen then press key" WHILE INKEY$ = "": WEND 5100 ' IF f2 / f1 <= 1.05 THEN GOTO 5110: lf$ = "1" ELSE GOTO 5150: lf$ = "0" END IF 'approx for low fractionnal pass band 5110 fc = SQR(f2 * f1): w0 = 2 * pi * fc * 1000000! 5120 bpf = (f2 - f1) / fc 5130 DEF FNwclfb (f) = ABS(1 / bpf * (f / fc - fc / f)) 5140 GOTO 5200 5150 fc = (f1 + f2 - SQR((f2 - f1) ^ 2 + f1 * f2)): w0 = 2 * pi * 1000000! * fc 5160 bpf = (fc / f1 - fc / f2) 5170 DEF FNwchfb (f) = ABS((2 - fc / f - 1 / (2 - fc / f)) / (2 - fc / f2 - 1 / (2 - fc / f2))) 5200 'draws the graph 5205 PRINT "RESPONSE GRAPH" 5206 ' 5210 SCREEN 12: WINDOW (-320, 399)-(320, 0) 5215 ' 5400 FOR x1 = -320 TO 320 5405 IF x1 = 0 THEN GOTO 5450 5410 xx = x1 / 640 / -.5 * bp * dil: f = fc - xx 5415 IF lf$ = "1" THEN wc = FNwclfb(f) ELSE wc = FNwchfb(f) 5420 IF lar = 0 THEN GOSUB 1100: GOTO 5440 5430 GOSUB 2200 5440 PSET (x1, la * 6) 5450 NEXT WHILE INKEY$ = "": WEND SCREEN 0: WIDTH 80, 50 6010 ' 6030 PRINT "Frequence centrale"; fc; "MHz" 6040 INPUT "Input low and high f for freq rejection info"; fl, fh 6035 interv = (fh - fl) / 40 6070 FOR f = fl TO fh STEP interv 6075 IF lf$ = "1" THEN wc = FNwclfb(f) ELSE wc = FNwchfb(f) 6080 IF lar = 0 THEN GOSUB 1100 ELSE GOSUB 2200 6085 PRINT "F="; TAB(4); f; TAB(12); "MHz"; TAB(20); "att"; TAB(25); FIX(la * 10 + .5) / 10; TAB(32); "dB" 6090 NEXT 6095 PRINT : PRINT "print screen then press key" WHILE INKEY$ = "": WEND 6100 'computes values 6110 ' 6115 CLS 6120 PRINT "Input"; n; "guessed values for parralel caps (in pF)": DIM c(n) 6125 ' 6130 FOR x = 1 TO n 6140 PRINT "C("; x; ")="; : INPUT c(x): c(x) = 1E-12 * c(x) 6150 NEXT 6155 PRINT "Inductance values" 6160 FOR x = 1 TO n 6170 PRINT "L"; x; "="; FIX((1 / c(x) / w0 ^ 2 * 1000000!) * 1000 + .5) / 1000; "æH" 6180 NEXT 6190 DIM j(n) 6200 IF lar = 0 THEN GOSUB 1000 ELSE GOSUB 2000 6210 j(0) = (ga * w0 * c(1) * bpf / g(0) / g(1)) ^ .5 6220 FOR j = 1 TO n - 1 6230 j(j) = bpf * w0 * (c(j) * c(j + 1) / g(j) / g(j + 1)) ^ .5 6235 NEXT 6240 j(n) = (gb * w0 * c(n) * bpf / g(n) / g(n + 1)) ^ .5 6250 PRINT "Coupling caps" 6255 DIM cc(n) 6260 PRINT "C 0 1 ="; : cc(0) = j(0) / w0 / SQR(1 - (j(0) / ga) ^ 2): PRINT FIX(cc(0) * 10 * 1E+12 + .5) / 10; "pF" 6270 FOR x = 1 TO n - 1 6280 PRINT "C"; x; x + 1; "="; : cc(x) = j(x) / w0: PRINT FIX(cc(x) * 10 * 1E+12 + .5) / 10; "pF" 6290 NEXT 6300 PRINT "C"; n; n + 1; "="; : cc(n) = j(n) / w0 / SQR(1 - (j(n) / gb) ^ 2): PRINT FIX(cc(n) * 10 * 1E+12 + .5) / 10; "pF" 6310 ' 6320 DIM cs(n) 6330 cs(1) = c(1) - cc(1) - cc(0) / (1 + (w0 * cc(0) / ga) ^ 2) 6340 FOR x = 2 TO n - 1 6350 cs(x) = c(x) - cc(x - 1) - cc(x) 6360 NEXT 6370 cs(n) = c(n) - cc(n - 1) - cc(n) / (1 + (w0 * cc(n) / gb) ^ 2) 6375 PRINT "Parralel caps" 6380 FOR x = 1 TO n 6390 PRINT "CS("; x; ")="; FIX(cs(x) * 10 * 1E+12 + .5) / 10; "pF" 6400 NEXT 6405 PRINT "Reflection coeff in passband="; tomax; "vswr="; (1 + tomax) / (1 - tomax)