10 REM ****************** Timer Calculations *************
20 REM By Ken L. Greene
30 REM #63 - 13435 97 Street
40 REM Edmonton, Alberta, Canada
50 REM T5E 4C8
60 REM (403) 475 2456
70 N=8
80 GOSUB 770
90 PRINT" TIMER CALCULATIONS"
100 PRINT" This program calculates values and times for these timers:"
110 PRINT TAB(10)"1     9601"
120 PRINT TAB(10)"2     9602"
130 PRINT TAB(10)"3     96L02"
140 PRINT TAB(10)"4     74121"
150 PRINT TAB(10)"5     74122"
160 PRINT TAB(10)"6     74123"
170 PRINT TAB(10)"7     555"
180 PRINT TAB(10)"8     556  (Dual 555)"
190 PRINT TAB(10)"9     To end"
200 PRINT:PRINT
210 INPUT"Enter the number corresponding to the desired timer :";T
220 IF T=9 THEN END
230 IF T>9 THEN GOTO 10
240 K1=K1(T):K2=K2(T):K3=K3(T)
250 RMAX=RMAX(T)
260 GOSUB 600
270 IF T$<>"T" AND T$<>"t" GOTO 340
280 GOSUB 540:GOSUB 560
290 T=K1+K2*R*C*(1+K3)/R)
300 SC=T:GOSUB 670:T=SC
310 T= INT(T*10)/10
320 PRINT "THE TIME IS ";T;SC$;"sec"
330 GOTO 260
340 IF T$<>"R" AND T$<>"r" THEN GOTO 450
350 GOSUB 560:GOSUB 580
360 R=((T-K1)/(K2*C))-K3
370 R1=R
380 SC=R:GOSUB 670:R=SC
390 R=INT(R*10)/10
400 PRINT "THE RESISTANCE IS ";R;SC$;"ohms"
410 IF R1<=RMAX THEN GOTO 260
420 PRINT:PRINT:PRINT"Resistance is greater than maximum resistance for this timer."
430 PRINT"use a larger value of capacitance for this time value.":PRINT:PRINT
440 GOTO 260
450 IF T$<>"C" AND T$<>"c" THEN GOTO 520
460 GOSUB 550:GOSUB 580
470 C=((T-K1)/K2)/(R+K3)
480 SC=C:GOSUB 670:C=SC
490 C=INT(C*10)/10
500 PRINT "THE CAPACITANCE IS ";C;SC$;"farads"
510 GOTO 260
520 IF T$<>"E" AND T$<> "e" THEN GOTO 260
530 GOTO 90
540 REM SUBROUTINE TO ASK FOR VALUE OF "R"
550 INPUT "Enter value for 'R' in ohms :";R:RETURN
560 REM SUBROUTINE TO ASK FOR VALUE FOR "C"
570 INPUT"Enter value for 'C' in farads";C:RETURN
580 REM SUBROUTINE TO ASK FOR VALUE FOR "T"
590 INPUT"Enter value for 'T' in seconds :";T:RETURN
600 REM SUBROUTINE TO ASK WHICH VARIABLE
610 PRINT"Enter letter for variable you wish to find :"
620 PRINT TAB(10)"R      resistor"
630 PRINT TAB(10)"C      Capacitor"
640 PRINT TAB(10)"T      Time"
650 PRINT TAB(10)"E      Exit"
660 INPUT T$:RETURN
670 REM SUBROUTINE TO SCALE VARIABLES & FIND SCALE FACTOR
680 IF SC>1E+06 THEN SC=SC/1E+06:SC$="M":RETURN
690 IF SC>1000! THEN SC=SC/1000!:SC$="K":RETURN
700 IF SC<1 THEN SC$="":RETURN
710 IF SC<1E-12 THEN SC=0:SC$="":RETURN
720 IF SC<1E-09 THEN SC=SC/1E-12:SC$="p":RETURN
730 IF SC<.000001 THEN SC=SC/1E-09:SC$="n":RETURN
740 IF SC<.001 THEN SC=SC/.000001:SC$="u":RETURN
750 IF SC<1 THEN SC=SC/.001:SC$="m":RETURN
760 RETURN
770 REM INITIALIZE TIMER CONSTANTS
780 FOR I=1 TO N
790 READ K1(I),K2(I),K3(I),RMAX(I):NEXT
800 RESTORE
810 DATA 0,.32,.7,20000
820 DATA 0,.31,1,20000
830 DATA 0,.33,3,200000
840 DATA 0,.693147,0,40000
850 DATA 0,.693147,0,40000
860 DATA 0,.693147,0,40000
870 DATA 0,1.1,0,20E6
880 DATA 0,1.1,0,20E6
890 RETURN
