This program designs resistive attenuator pads for audio lines. You pick a T or H pad (equal or tapered impedances, unbalanced or balanced) or an L or U pad (tapered), enter the impedances and, for equal impedances, the loss in decibels, and it prints the resistor values with a small drawing of the network. Tapered pads work out the minimum loss for the two impedances themselves.
It has no title screen or credit; the opening line reads “Design an audio line impedence matching network of attenuator”. It is a different program from Attenuator Pads on this site.
Program Analysis
The menu (lines 5–50) jumps to 100, 200, 300 or 400 by GO TO s*100. The subroutines at 500–535 read the impedances and loss and turn the loss into a ratio k; the design routines then compute the series arms ra, rb and the shunt rc, halving the arms for balanced (H and U) pads. Lines 1000–2055 print the results and draw the network with PLOT and DRAW.
Potential Issues
- Line 525 appears to compute the loss ratio wrongly:
k=EXP ((db/20)/(LN (2.71828)/LN (10))+1)adds 1 inside the exponent, so 10 dB gives about 8.6 instead of 3.16. For a 600-ohm, 10 dB T pad the arms come out at 475 ohms, where the usual value is about 312. - The shunt value in line 126,
INT ((z+k)/(k^2-1)), also does not match the usual formula, 2zk/(k²−1). - The opening menu prints four columns with commas, which wrap on the 32-column screen.
- Line 115 puts its
IF n=2test afterIF n=1 THEN GO TO 120on the same line. In Sinclair BASIC a false IF skips the rest of the line, so choosing 2 (tapered) falls through to the symmetrical design at line 120.
This copy came from a Larken disk and was converted for tape: the LKDOS prefix on the save line and the LOGICALL menu load were removed. It was tested in ZEsarUX.
Source Code
5 CLS : PRINT
10 PRINT "Design an audio line impedence matching network of attenuator."''
15 PRINT "Kind","Z in/out","Configuration","Select one"''
20 PRINT "T","Equal/taper","Unbalanced","1"
25 PRINT "H","Equal/taper","Balanced","2"
30 PRINT "L","Taper","Unbalanced","3"
35 PRINT "U","Taper","Balanced","4"''
45 INPUT "Enter number for circuit desired";s
48 IF s>4 THEN PRINT '"Error - Do over": PAUSE 100: GO TO 45
50 GO TO s*100
75 STOP
100 CLS : PRINT '''"Input and output impedances are equal, Symmetrical.....1"
105 PRINT '"Input and output are not equal, Taper.....2"
110 INPUT "Enter number for circuit desired ";n
115 IF n=1 THEN GO TO 120: IF n=2 THEN GO TO 150: IF n<>1 OR n<>2 THEN GO TO 110
120 CLS : GO SUB 510: CLS
125 LET ra=INT (z*((k-1)/(k+1)))
126 LET rc=INT ((z+k)/(k^2-1)): LET a=z: LET b=z
127 LET rb=rc
130 LET ra=ra+1: IF s=2 THEN GO TO 205: CLS
135 LET t$="T": LET b$="UNBALANCED": LET I$="SYMMETRICAL": LET U$="Match impedance and reduce power level."
140 GO SUB 1000: GO SUB 1020: GO SUB 1055
145 GO SUB 2000: GO SUB 2025: GO SUB 2025: GO TO 3000
150 GO SUB 500: GO SUB 530: GO SUB 525: CLS
155 LET ka=(k-1)/(k+1): LET kb=(k^2-1)/(2*k): LET rc=INT ((a+b)/(2*kb))
160 LET ra=INT ((((a+b)*ka)+(a-b))/2)
165 LET rb=INT ((((a+b)*ka)-(a-b))/2)
170 LET rc=rc+1: IF s=2 THEN GO TO 250
175 LET t$="T": LET b$="UNBALANCED": LET I$="Taper": LET u$="Match impedance and reduce powerlevel"
180 GO SUB 1000: GO SUB 1025: GO SUB 1055
185 GO SUB 2000: GO SUB 2025: GO SUB 2025: GO SUB 2055: GO TO 3000
200 GO TO 100
205 LET ra=INT (ra/2): LET rb=INT (rb/2)
210 CLS
215 LET t$="H": LET b$="BALANCED": LET i$="Symmetrical": LET u$="Match impedance and reduce powerlevel"
220 GO SUB 1000: GO SUB 1050
225 GO TO 3000
250 LET ra=INT (ra/2): LET rb=INT (rb/2)
255 LET t$="T": LET b$="BALANCED": LET i$="Taper": LET u$="Match unequal impedances"
260 GO SUB 1000: GO SUB 1035: GO SUB 1050
265 GO SUB 2000: GO SUB 2030: GO SUB 2055: GO TO 3000
300 CLS
305 GO SUB 500: GO SUB 530: LET db=db+1: GO SUB 525
310 LET ra=INT ((a/SQR (a/b))*((k*SQR (a/b))-1/k))
315 LET rc=INT ((a/SQR (a/b))*(1/k-SQR (a/b)))
320 LET t$="L": LET b$="UNBALANCED": LET i$="Taper": LET u$="Match unequal impedance"
325 GO SUB 1000: GO SUB 1040: GO SUB 1055
330 GO SUB 2015: GO SUB 2025: GO SUB 2055: GO TO 3000
400 CLS
405 GO SUB 500: GO SUB 530: CLS : LET ro=b/a
410 LET ra=INT (a*((SQR (1-ro))/2))
415 LET rc=INT (a*(ro/SQR (1-ro))): LET rc=rc+1
420 LET t$="U": LET b$="BALANCED": LET i$="Taper": LET u$="Match unequal impedances"
425 GO SUB 1000: GO SUB 1045
430 GO SUB 2015: GO SUB 2045: GO SUB 2055: GO TO 3000
500 PRINT '"Enter the larger of 2 impedances"
501 INPUT a: PRINT a
505 PRINT '"Enter the smaller of2 impedances": INPUT b: PRINT b: PAUSE 30: RETURN
510 PRINT '"Enter the attenuator impedance ": INPUT z: PRINT z
515 PRINT '"Enter the required loss in DB"
520 INPUT "DB loss can be 0.5 TO 30+ in some cases ";db: PRINT db
525 LET k=EXP ((db/20)/(LN (2.71828)/LN (10))+1): RETURN
530 LET db=INT (ABS (20*(LN (SQR (1/a/b))/(1+SQR (1-(1/(a/b)))))/LN (10))+1)
535 RETURN
999 STOP
1000 PRINT AT 1,0;"Type ";t$;AT 2,0;b$
1005 PRINT AT 3,0;"Loss in DB: ";db
1010 PRINT AT 4,0;i$
1015 PRINT AT 5,0;"USE ";u$: RETURN
1020 PRINT AT 7,0;ra;AT 8,0;ra;AT 9,0;a;AT 10,0;rc;AT 11,0;a: RETURN
1025 PRINT AT 7,0;ra;AT 8,0;rb;AT 9,0;a;AT 10,0;rc;AT 11,0;b: RETURN
1030 PRINT AT 7,0;ra;AT 8,0;ra;AT 9,0;a;AT 10,0;rc;AT 11,0;a;AT 12,0;ra;AT 13,0;ra: RETURN
1035 PRINT AT 7,0;ra;AT 8,0;rb;AT 9,0;a;AT 10,0;rc;AT 11,0;b;AT 12,0;ra;AT 13,0;rb: RETURN
1040 PRINT AT 7,0;ra;AT 8,0;a;AT 9,0;rc;AT 10,0;b: RETURN
1045 PRINT AT 7,0;ra;AT 8,0;a;AT 9,0;rc;AT 10,0;b;AT 11,0;ra: RETURN
1050 PRINT AT 15,0;"If necessary ground at center of 'RC' Ohms resistor.": RETURN
1055 PRINT AT 15,0;"If necessary lower line may be grounded.": RETURN
1999 STOP
2000 LET y=16: FOR x=4 TO 36: PLOT x,y: NEXT x
2005 LET y=16: FOR x=49 TO 70: PLOT x,y: NEXT x
2010 LET y=16: FOR x=85 TO 120: PLOT x,y: NEXT x: RETURN
2015 LET y=16: FOR x=4 TO 36: PLOT x,y: NEXT x
2020 LET y=16: FOR x=49 TO 120: PLOT x,y: NEXT x: RETURN
2025 LET y=28: FOR x=4 TO 120: PLOT x,y: NEXT x: RETURN
2030 LET y=28: FOR x=4 TO 36: PLOT x,y: NEXT x
2035 LET y=28: FOR x=49 TO 70: PLOT x,y: NEXT x
2040 LET y=28: FOR x=85 TO 120: PLOT x,y: NEXT x: RETURN
2045 LET y=28: FOR x=4 TO 36: PLOT x,y: NEXT x
2050 LET y=28: FOR x=49 TO 120: PLOT x,y: NEXT x: RETURN
2055 LET x=60: FOR y=16 TO 19: PLOT x,y: NEXT y
2060 LET x=60: FOR y=24 TO 28: PLOT x,y: NEXT y: RETURN
2999 STOP
3000 INPUT "Press <ENTER> to start a new calculation. ";a$: GO TO 5
8999 STOP
9000 SAVE "ANFil 1": STOP
9010 VERIFY "ANFil 1"
9992 SAVE "ANFil.B1" LINE 1
9998 REM was LKDOS-onlyNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

