This file is part of Long Island Sinclair Timex (LIST) User Group Library Tape #3.5. Download the collection to get this file.
Asks for a voltage and a current, prints the exact resistance by Ohm’s law, and then picks the next standard value at or above it from the 10–12–15–18–22–27–33–39–47–56–68–82 series. It also reports the current and power dissipation that the chosen resistor gives at that voltage.
Program Analysis
How It Works
Line 200 finds the decade with INT (LN R/2.303)-1, and lines 210–240 read the series from DATA and scale each value by 10^L until one is at least as large as the computed resistance. Current and wattage are rounded to two decimal places with INT (x*100)/100.
Potential Issues
- Line 170,
LET R=(V*100/I)/100, looks like an intended rounding to two places but omitsINT, so it just computes V/I. - There is no
RESTOREbefore the series is read, so each later calculation continues from wherever the previous one stopped in the DATA and soon runs out.
Source Code
10 REM *************************
20 PRINT "resval"
30 PRINT
40 PRINT "PROGRAM DERIVES PREFERRED VALUE"'"OF RESISTOR FROM INPUT"'"VOLTAGE AND CURRENT VALUES"
50 PRINT
70 PRINT "SAVE WITH GOTO 340"
80 PAUSE 800
90 CLS
100 PRINT "VOLTAGE?";: INPUT V
120 PRINT TAB 12;V;"VOLTS"
130 PRINT
140 PRINT "CURRENT?";: INPUT I
160 PRINT TAB 12;I;"AMPS"
170 LET R=(V*100/I)/100
180 PRINT
190 PRINT "ACTUAL RESISTANCE ";R;" OHM"
200 LET L=INT (LN R/2.303)-1
210 FOR N=1 TO 13
215 READ X
220 IF R<=X*10^L THEN GO TO 240
230 NEXT N
240 LET X=X*10^L
245 PRINT
250 PRINT "PREFERRED RESISTOR:";X;" OHM"
255 PRINT
260 PRINT "GIVES CURRENT"; TAB 19;INT (V*100/X)/100;" AMP"
270 PRINT "AND ";INT (V^2*100/X)/100;" WATTS"
280 PRINT
290 PRINT "AGAIN? (Y/N)": INPUT Q$
300 DATA 10,12,15,18,22,27,33,39,47,56,68,82,100
310 IF Q$="N" THEN STOP
320 CLS
330 GO TO 100
340 SAVE "RESVAL" LINE 10Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.