Sometimes, it's the little things that are just so darn handy to have around.
I'm often confronted with having to choose a parallel pair of resistors to get as close as possible to some non-standard resistance value. Here's how I've been doing that using either standard value resistors from the ±5% tolerance list or from the ±1% list.
The GWBASIC code at the end of this item is a program called "parallel.bas" which accepts a numerical value of ohms from you the user and returns suggested parallel resistor combinations that most closely match your required value.
You are first asked if your resistor choices should come from the ±5% RETMA values set or from the ±1% set. You are then asked for your desired ohmic value and off it all goes.
In this first example, I show having chosen the ±5% RETMA values and that for a desired value of 12356 ohms, there are two parallel set suggestions which are of nominal parallel value errors of approximately +0.78% and -1.89%.
Having made its presentation, the program asks you for another desired number of ohms. The whole process repeats indefinitely until you halt things with a CTRL-BREAK.
Note too that scaling is performed. In the display above, gong from 12356 to 1235.6 to 123.56 yields parallel pair suggestions that are appropriately scaled versus the required resistance value..
In the following example, the choice is made to use the ±1% RETMA values. Then everything works just as described above.
Note that with these more tightly toleranced resistors, you get more suggestions than before. You get six suggestions in this example versus only the two suggestions that were shown further above.
10 SCREEN 9:COLOR 15,0:DIM RA(672),RB(672)
20 CLS:LOCATE 1,1:PRINT "save "+CHR$(34)+"parallel.bas"+CHR$(34):PRINT
30 PRINT "save "+CHR$(34)+"a:\parallel.bas"+CHR$(34)
40 C$=" ####### #######.### ####### ####### ##.##### %"
50 DATA 100,102,105,107,110,113,115,118,121,124,127,130,133,137,140,143,147
60 DATA 150,154,158,162,165,169,174,178,182,187,191,196,200,205,210,215,221
70 DATA 226,232,237,243,249,255,261,267,274,280,287,294,301,309,316,324,332
80 DATA 340,348,357,365,374,383,392,402,412,422,432,442,453,464,475,487,499
90 DATA 511,523,536,549,562,576,590,604,619,634,649,665,681,698,715,732,750
100 DATA 768,787,806,825,845,866,887,909,931,953,976
110 DATA 100,110,120,130,150,180,200,220,240,270,300
120 DATA 330,360,390,430,470,510,560,620,680,750,820,910
130 RESTORE 50:TOL=.1:LOCATE 6,1:RETMA=0:GOTO 150
140 COLOR 11,1:PRINT "Line printer will respond!":COLOR 15,1:RETURN
150 PRINT "Do you want RETMA 1% values or 5% values (1 or 5) ";:INPUT RETMA
160 RN=96+(1-RETMA)*73/4:IF (RETMA-1)*(RETMA-5)<>0 THEN GOTO 130
170 LOCATE 8,1:PRINT "Parallel resistor combinations using";RETMA;"% values:"
180 IF RN=23 THEN TOL=2
190 IF RN=23 THEN RESTORE 110
200 FOR X=(RN*2+1) TO RN*3:READ RA(X):FOR K=-2 TO 4
210 RA(X+K*RN)=RA(X)*10^K:NEXT K:NEXT X:FOR X=1 TO RN*7:RB(X)=RA(X):NEXT X
220 LP=0:IF LP=1 THEN GOSUB 140:REM LP = 1 will enable line printer output.
230 PRINT:INPUT "What is your desired resistance value (in ohms) ";R
240 IF R=0 THEN GOTO 20
250 IF RN=96 THEN RSTART=189+CINT(41.67885*LOG(R/99.96))
260 IF RN=23 THEN RSTART=CINT(10*LOG(R)+5)
270 RSTOP=RSTART+RN:IF RSTOP>RN*7 THEN RSTOP=RN*7
280 FOR X=RSTART TO RSTOP:FOR Y=RSTART TO RSTOP:RT=1/(1/RA(X)+1/RB(Y))
290 PCT=(RT-R)/R/.01:IF ABS(PCT)>TOL THEN GOTO 330
300 IF RB(Y)<RA(X) THEN GOTO 220
310 PRINT USING C$;R,RT,RA(X),RB(Y),PCT
320 IF LP=1 THEN LPRINT USING C$;R,RT,RA(X),RB(Y),PCT
330 NEXT Y:NEXT X:PRINT:GOTO 220
Of course, this code will also work with Q-BASIC if entered into that program as a plain ASCII file.
Note: The resistor thumbnail image in this blog was taken from Wikimedia.org