ZX81 Parallel Resistor Calculator

See all articles from QZX v6 n11
Author(s): Alex Burr (K5XY)
Publication: QZX
Pub Details: QZX v6 n11 (Volume 6, Issue 11)
Date: October 1988
Pages: 3-4

Here is a short and simple program for the ZX81, TS1000, and TS1500 which will tell you what value of resistance must be put in parallel with an existing resistor to get a desired value. The program will be helpful if you are trouble shooting an already constructed circuit which is not working correctly. If you want to reduce the value of a resistor already in place, sometimes the easiest thing to do is to solder another resistor in parallel with the first. The program will also be useful during new construction when your junk box does not contain the needed resistance value. Often two resistors can be put in parallel to get the desired value.

Remember that when you put any resistor in parallel with a known resistor, the result is always less than the resistance with which you started. If the desired resistor is bigger than the starting resistor, another one must be put in series. That calculation is too simple to require a computer program.

ZX81 Parallel resistor calculator

100 CLS
110 PRINT "PROGRAM TO FIND THE
VALUE OF R NEEDED TO
BE PUT IN PARALLEL
WITH A KNOWN RESISTOR,
RK, TO GET A TARGET
RESISTANCE, RT."
120 PRINT "ENTER THE VALUE OF
THE KNOWN RESISTOR
(IN OHMS)."
130 INPUT RK
140 PRINT "WHAT IS THE VALUE OF
RESISTANCE YOU WISH
TO HAVE (IN OHMS)."
150 INPUT RT
160 LET R = RT*RK/(RK-RT)
170 PRINT "THE VALUE OF R YOU
MUST PUT IN PARALLEL
WITH ";RK;" OHMS TO
GET THE TARGET
VALUE ";RT;" OHMS IS"
180 PRINT " R = ";R;" OHMS."
190 PRINT
200 PRINT
210 PRINT "DO YOU WANT TO DO
ANOTHER CALCULATION
(Y OR N)"
220 INPUT A$
230 IF A$="Y" THEN GOTO 100
240 PRINT "THAT IS ALL FOR NOW."
250 STOP

The program is quite straight forward, but I shall mention some of its features for the begining programers among our readers. First some general comments. I start with line 100 rather than 10 so that, when the line numbers enter the 100 region, the line contents are not spaced over one column to accommodate the additional digit. I increase the line numbers by 10 each time so that I can easily add lines without renumbering if it becomes necessary. There are a lot of print statements to make the program self documenting. These print lines could easily be made shorter and easier to type in, but they then would be less informative. It is better to spend a little extra time on the original program than to have to spend a lot of time later trying to decide just what you intended when the program was first written.

Comments on individual lines follow. Line 100 clears the screen so you can start with a clean TV, uncluttered by previous programs or previous runs of this program. Some programs start off with a non-working REM statement that tells the reader what the program does. This program prints that statement on the screen where it can be read without listing the program. Line 110 does this task.

The next four lines provide for the input of the data which the program needs. The input statements (lins 130 and 150) accept the desired input. Lines 120 and 140 provide statements on the screen which tell you just what data the program requires. Line 160 is the one line of the program which does the desired calculation. The following print lines display the data you put in (and hence let you check it) and the result of the calculation, which is the answer you want. Note particularly the spaces just inside the quote symbols in these print statements. They must be put in correctly to have the words in the resulting sentences spaced properly.

Line 210 starts a branch section. You are asked if you wish to do another, similar calculation. If you answer Y, line 230 returns you to the start of the program. If you answer N, the program says good bye and stops. Do not forget the quotes around the Y in line 230.

Note that the program actually stops if you enter anything other than Y. If you are a begining programer, you might want to try to think up an error checking routine which would not automatically regard any answer except Y as a no. The answer will be given next month.