Designs resistive attenuator pads. For an H or T pad you enter the loss in dB and the input and output impedances, and the program calculates the series and shunt resistors. For an L pad, the minimum-loss matching type, you enter the larger and smaller impedances and it works out both resistors and the resulting loss. Results appear on a character-drawn schematic, with xxxx for the series resistors and a column of X for the shunt arm, labelled with values rounded to the nearest ohm.
REM lines credit Larry Friedman and Ron G and say the program is written in "Universal BASIC". They cite "Attenuators and Minimum Loss Pads", from the December 1985 Radio-Electronics Computer Digest, and are dated 11-1-85.
Program Analysis
Program Structure
- Lines 60–130: the pad-type menu.
- Lines 140–200: the H and T calculation. The power ratio is
N=EXP(Db*0.230259)(10dB/10), the shunt arm isR3=2*SQR(N*z1*z2)/(N-1), and the two series arms areR1=z1*(N+1)/(N-1)-R3andR2=z2*(N+1)/(N-1)-R3. - Lines 1000–1120: the H pad diagram, which splits each series arm in half between the top and bottom legs.
- Lines 2000–2110: the T pad diagram, which is reused for the L pad.
- Lines 3000–3090: the L pad, using
R1=SQR(z1*(z1-z2)),R2=z1*z2/R1and a minimum loss of20*log10(SQR(z1/z2)+SQR(z1/z2-1)), withLOGwritten asLN(...)/2.30259.
Notable Techniques
- Only
PRINT,TABand plain characters are used, with no colour or graphics characters, in keeping with the "Universal BASIC" note.
Potential Issues
- The T pad diagram prints only
R1and the shuntR3. The output-side series resistorR2is calculated but never shown, which matters when the input and output impedances differ. - A pad type below 1 is not rejected. The program runs the H/T calculation and goes straight to the "Do it again?" prompt without printing anything.
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.
Source Code
10 REM attenuator pads
12 REM by
14 REM Larry Friedman & Ron G
16 REM Calculates H, T, L Pads
18 REM In Universal BASIC
20 REM
30 REM Attenuators and Minimum
35 REM Loss Pads
40 REM
43 REM Dec 85 Radio
45 REM Electronics
49 REM Computer Digest
51 REM
53 REM 11-1-85
55 INK 0: PAPER 7: BORDER 7: CLS
58 REM
60 CLS : LET z1=0: LET z2=0: LET Db=0
70 PRINT TAB (10);"1 = H Pad"
80 PRINT TAB (10);"2 = T Pad"
90 PRINT TAB (10);"3 = L Pad"
100 INPUT "Enter Pad Type (1, 2, or 3) ";T
110 CLS
120 IF T=3 THEN GO TO 3000
130 IF T>3 THEN GO TO 60
140 INPUT "Input Loss in Db ";Db
150 LET N=EXP ((Db)*0.230259)
160 INPUT "Input Z in ";z1
170 INPUT "Input Z out ";z2
180 LET R3=(2*SQR (N*z1*z2))/(N-1)
190 LET R1=z1*((N+1)/(N-1))-R3
200 LET R2=z2*((N+1)/(N-1))-R3
210 CLS
220 IF T=1 THEN GO TO 1000
230 IF T=2 THEN GO TO 2000
240 CLS
250 INPUT "Do it again? (Y or N) ";q$
260 IF q$="Y" OR q$="y" THEN GO TO 110
270 CLS
280 STOP
1000 PRINT " ";INT (R1/2+.5);TAB (16);INT (R2/2+.5)
1010 PRINT "----xxxx--------xxxx----"
1020 PRINT TAB 12;"!"'TAB (12);"!"
1030 PRINT TAB (12);"X"
1040 PRINT TAB (12);"X ";INT (R3+.5)
1050 PRINT TAB (12);"X"
1060 PRINT TAB 12;"!"'TAB (12);"!"
1070 PRINT "----xxxx--------xxxx----"
1080 PRINT " ";INT (R1/2+.5);TAB (16);INT (R2/2+.5)
1090 PRINT
1100 PRINT z1;" ohms in, ";z2;" ohms out "
1110 PRINT " Loss in Db = ";Db
1120 GO TO 250
2000 PRINT " ";INT (R1+.5)
2010 PRINT "----xxxx----------------"
2020 PRINT TAB 12;"!"'TAB (12);"!"
2030 PRINT TAB (12);"X"
2040 PRINT TAB (12);"X ";INT (R3+.5)
2050 PRINT TAB (12);"X"
2060 PRINT TAB 12;"!"'TAB (12);"!"
2070 PRINT "------------------------"
2080 PRINT
2090 PRINT z1;" ohms in, ";z2;" ohms out "
2095 IF T=3 THEN GO TO 250
2100 PRINT " Loss in Db = ";Db
2110 GO TO 250
3000 INPUT "Input larger Z ";z1
3010 INPUT "Input smaller Z ";z2
3020 IF z2>z1 THEN PRINT "ERROR": GO TO 3000
3030 LET R1=SQR (z1*(z1-z2))
3040 LET R2=(z1*z2)/R1
3050 LET R3=R2
3060 LET L=20*LN (SQR (z1/z2)+SQR ((z1/z2)-1))/2.30259
3070 CLS
3080 PRINT "Loss is ";L;" Db"
3090 GO TO 2000
9000 RANDOMIZE USR 100: SAVE "pads.Ba" LINE 1Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

