home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
misc
/
ham436
/
hamcalc.bas
< prev
next >
Wrap
BASIC Source File
|
1985-05-08
|
11KB
|
282 lines
10 PRINT "THIS PROGRAM WILL COMPUTE MISCELLANEOUS ";
20 PRINT "ELECTRONIC FORMULAS":PRINT
30 PRINT "IF NOT SPECIFIED, ALL ENTRIES ARE IN UNITS":PRINT
40 REM PROGRAM BY PAUL CRABTREE
50 PRINT TAB(21)"ENTER NUMBER OF ITEM":PRINT
60 CLEAR
70 PRINT
80 DIM R1(20),C1(20),L1(20)
90 FOR X=1 TO 12:READ B$:IF B$="777"GOTO 110
100 NEXT X
110 FOR A=1 TO 20:READ B$
120 IF B$="999"GOTO 240
130 ON A GOTO 150,160,150,160,150,160,150,160,150,160
140 ON A-10 GOTO 150,160,150,160,150,160,150,160
150 PRINT TAB(5)B$,:GOTO 170
160 PRINT TAB(40)B$
170 NEXT A
180 PRINT "IF YOU HAVE MORE VALUES FOR THIS PROGRAM"
190 PRINT "TYPE 'YES'. IF YOU WISH TO GO TO THE MAIN LIST THEN"
200 LINE INPUT "TYPE 'N0' ? ";M$
210 IF M$="YES"THEN RETURN
220 IF M$="NO"GOTO 60
230 GOTO 180
240 PRINT :INPUT "WHAT ITEM NUMBER FROM MAIN LIST ? ";Q
250 IF Q>18 GOTO 240
260 IF Q<1 GOTO 240
270 ON Q GOTO 390,1200,1480,1590,1730,1950,2010,2170,2300,950,1010
280 ON Q-11 GOTO 1050,1100,2640,1280,1370,500,610
290 DATA "BLACK","BROWN","RED","ORANGE","YELLOW","GREEN"
300 DATA "BLUE","VIOLET","GRAY","WHITE","777"
310 DATA "1 PARALLEL RESISTORS","2 RESONANT FREQUENCY"
320 DATA "3 SERIES CAPACITORS","4 REACTANCE","5 IMPEDANCE"
330 DATA "6 ANTENNA LENGTH","7 OHMS LAW","8 POWER FORMULA"
340 DATA "9 RESISTOR COLOR CODE","10 TRANSFORMER TURNS RATIO"
350 DATA "11 DECIBELS","12 CONDUCTANCE","13 FREQUENCY TO TIME"
360 DATA "14 TRANSMISSION LINE","15 ANT FIELD STRENGTH"
370 DATA "16 PEAK RADAR PULSE POWER","17 PARALLEL INDUCTORS"
380 DATA "18 PROGRAM CONVERSION TABLE","999"
390 PRINT "THIS PROGRAM WILL CALCULATE PARALLEL RESISTORS"
400 INPUT "HOW MANY RESISTORS ? ";R
410 T=0:IF R>18 GOTO 400
420 IF R<2 GOTO 400
430 FOR X=1 TO R:PRINT "RESISTOR VALUE ";X;" IN OHMS";
440 INPUT " ? ";R1(X):IF X=R GOTO 460
450 NEXT X
460 FOR X=1 TO R:T=T+(1/R1(X)):IF X=R GOTO 480
470 NEXT X
480 PRINT "TOTAL RESISTANCE IS ";1/T;" OHMS"
490 GOSUB 180:PRINT :GOTO 400
500 PRINT "THIS PROGRAM WILL CALCULATE PARALLEL INDUCTORS"
510 INPUT "HOW MANY INDUCTORS ? ";L
520 T=0:IF L>18 GOTO 510
530 IF L<2 GOTO 510
540 FOR X=1 TO L:PRINT "INDUCTOR VALUE ";X;" IN HENRYS";
550 INPUT " ? ";L1(X):IF X=L GOTO 570
560 NEXT X
570 FOR X=1 TO L:T=T+(1/L1(X)):IF X=L GOTO 590
580 NEXT X
590 PRINT "TOTAL INDUCTANCE IS ";1/T;" HENRYS"
600 GOSUB 180:PRINT :GOTO 510
610 PRINT "THIS PROGRAM WILL CONVERT ENTRIES (TO BE USED IN ";
620 PRINT "MAIN PROGRAM) TO UNITS"
630 PRINT "CONVERT ITEM"
640 PRINT "(1)GIGA, (2)MEGA, (3)KILO, (4)MILLI, (5)MICRO,";
650 PRINT " (6)NANO, OR (7)PICO"
660 INPUT "TO UNITS ? ";U
670 IF U=1 GOTO 890
680 IF U=2 GOTO 740
690 IF U=3 GOTO 770
700 IF U=4 GOTO 800
710 IF U=5 GOTO 830
720 IF U=6 GOTO 920
730 IF U=7 GOTO 860
740 INPUT "MEGA VALUE ? ";U
750 PRINT "MEGA VALUE ";U;" IS ";U*1000000!;" IN UNITS"
760 GOSUB 180:PRINT :GOTO 630
770 INPUT "KILO VALUE ? ";U
780 PRINT "KILO VALUE ";U;" IS ";U*1000;" IN UNITS"
790 GOSUB 180:PRINT :GOTO 630
800 INPUT "MILLI VALUE ? ";U
810 PRINT "MILLI VALUE ";U;" IS ";U*.001;" IN UNITS"
820 GOSUB 180:PRINT :GOTO 630
830 INPUT "MICRO VALUE ? ";U
840 PRINT "MICRO VALUE ";U;" IS ";U*.000001;" IN UNITS"
850 GOSUB 180:PRINT :GOTO 630
860 INPUT "PICO VALUE ? ";U
870 PRINT "PICO VALUE ";U;" IS ";U*1E-12;" IN UNITS"
880 GOSUB 180:PRINT :GOTO 630
890 INPUT "GIGA VALUE ? ";U
900 PRINT "GIGA VALUE ";U;" IS ";U*1000000000#;" IN UNITS"
910 GOSUB 180:PRINT :GOTO 630
920 INPUT "NANO VALUE ? ";U
930 PRINT "NANO VALUE ";U;" IS ";U*9.999999E-10;" IN UNITS"
940 GOSUB 180:PRINT :GOTO 630
950 PRINT "THIS PROGRAM WILL CALCULATE SECONDARY VOLTAGE"
960 INPUT "PRIMARY VOLTAGE ? ";P
970 INPUT "SECONDARY TURNS ? ";S
980 INPUT "PRIMARY TURNS ? ";P1
990 PRINT "THE SECONDARY VOLTAGE IS ";P*(S/P1)
1000 GOSUB 180:PRINT :GOTO 960
1010 PRINT "THIS PROGRAM WILL CALCULATE DECIBEL RATIO OF TWO POWERS"
1020 INPUT "ENTER POWER ONE ? ";P1:INPUT "ENTER POWER TWO ? ";P2
1030 PRINT "THE DECIBEL VALUE IS ";10*(LOG(P1/P2)/LOG(10));" DB"
1040 GOSUB 180:PRINT :GOTO 1020
1050 PRINT "THIS PROGRAM WILL CALCULATE CONDUCTANCE IN MHOS"
1060 INPUT "WHAT IS THE RESISTANCE ? ";R
1070 IF R<=0 GOTO 1060
1080 PRINT "THE CONDUCTANCE IS ";1/R;" MHOS"
1090 GOSUB 180:PRINT :GOTO 1060
1100 PRINT "THIS PROGRAM WILL CALCULATE FREQUENCY TO TIME"
1110 INPUT "IS FREQUENCY IN HZ (1) OR KHZ (2) ? ";M
1120 IF M=1 GOTO 1150
1130 IF M=2 GOTO 1170
1140 GOTO 1110
1150 INPUT "FREQUENCY IN HZ ? ";F
1160 PRINT "THE FREQUENCY IS EQUAL TO ";1/F;" SECONDS":GOTO 1190
1170 INPUT "FREQUENCY IN KHZ ? ";F
1180 PRINT "THE FREQUENCY IS EQUAL TO ";1/(F/1000);" MICROSECONDS"
1190 GOSUB 180:PRINT :GOTO 1110
1200 PRINT "THIS PROGRAM WILL CALCULATE RESONANT FREQUENCY"
1210 INPUT "INDUCTANCE IN HENRYS ? ";L
1220 INPUT "CAPACITANCE IN FARADS ? ";C
1230 P=2*(4*ATN(1)):P=P*(SQR(L*C)):P=1/P
1240 PRINT "THE RESONANT FREQUENCY IS ";P;" HZ"
1250 A=P/1000:B=A/1000:C=B/1000
1260 PRINT "IN KHZ";A;" IN MHZ";B;" IN GEGA HZ";C
1270 GOSUB 180:PRINT :GOTO 1210
1280 PRINT "THIS PROGRAM WILL CALCULATE FIELD STRENGTH"
1290 PRINT "AT MODERATE DISTANCES FROM THE TRANSMITTING ANTENNA"
1300 INPUT "WHAT IS THE EFFECTIVE ANTENNA HEIGHT IN METERS ? ";B
1310 INPUT "WHAT IS THE ANTENNA CURRENT IN AMPERES ? ";I
1320 INPUT "WHAT IS THE OPERATING WAVELENGTH IN METERS ? ";W
1330 INPUT "WHAT IS THE DISTANCE FROM ANTENNA IN METERS ? ";R
1340 E=(188*B*I)/(W*R)
1350 PRINT "THE FIELD STRENGTH IS ";E;" MILLIVOLTS PER METER"
1360 GOSUB 180:PRINT :GOTO 1300
1370 PRINT "THIS PROGRAM WILL CALCULATE THE PEAK"
1380 PRINT "POWER OF A RADAR PULSE"
1390 INPUT "WHAT IS THE PULSE WIDTH IN MICROSECONDS ? ";W
1400 INPUT "WHAT IS THE PULSE REPETION RATE ? ";R
1410 INPUT "WHAT IS THE AVERAGE POWER IN WATTS ? ";P
1420 D1=1/R:W1=W/1000000!
1430 D1=W1/D1
1440 P1=P/D1:REM PEAK POWER
1450 PRINT "THE PEAK POWER IS ";P1;" WATTS"
1460 PRINT "THE DUTY CYCLE IS ";D1
1470 GOSUB 180:PRINT :GOTO 1370
1480 PRINT "THIS PROGRAM WILL CALCULATE SERIES CAPACITORS"
1490 INPUT "HOW MANY CAPACITORS ? ";C
1500 T=0:IF C>18 GOTO 1490
1510 IF C<2 GOTO 1490
1520 FOR X=1 TO C:PRINT "CAPACITOR VALUE ";X;" IN FARADS";
1530 INPUT " ? ";C1(X):IF X=C GOTO 1550
1540 NEXT X
1550 FOR X=1 TO C:T=T+(1/C1(X)):IF X=C GOTO 1570
1560 NEXT X
1570 PRINT "TOTAL CAPACITANCE IS ";1/T;" FARADS"
1580 GOSUB 180:PRINT :GOTO 1490
1590 PRINT "THIS PROGRAM WILL CALCULATE INDUCTIVE AND CAPACITIVE ";
1600 PRINT "REACTANCE"
1610 INPUT "SOLVE FOR INDUCTIVE (1) OR CAPACITIVE (2) REACTANCE ? ";R
1620 IF R=2 GOTO 1680
1630 PRINT "SOLVE FOR INDUCTIVE REACTANCE"
1640 INPUT "FREQUENCY IN HERTZ ? ";F
1650 INPUT "INDUCTANCE IN HENRYS ? ";L
1660 P=2*(4*ATN(1))
1670 PRINT "THE INDUCTIVE REACTANCE IS ";P*(F*L);" OHMS":GOTO 1720
1680 PRINT "SOLVE FOR CAPACITIVE REACTANCE"
1690 INPUT "FREQUENCY IN HERTZ ? ";F
1700 INPUT "CAPACITANCE IN FARADS ? ";C
1710 PRINT "THE CAPACITIVE REACTANCE IS ";1/(3.1416*(F*C));" OHMS"
1720 GOSUB 180:PRINT :GOTO 1610
1730 PRINT "THIS PROGRAM WILL CALCULATE SERIES OR PARALLEL IMPEDANCE"
1740 INPUT "SERIES (1) OR PARALLEL (2) CIRCUIT ? ";Q
1750 IF Q=2 GOTO 1860
1760 INPUT "RESISTANCE VALUE IN OHMS ? ";R
1770 INPUT "CAPACITANCE VALUE IN FARADS ? ";C
1780 INPUT "INDUCTANCE VALUE IN HENRYS ? ";L
1790 IF C=L THEN Z=R:GOTO 1840
1800 IF L>C GOTO 1820
1810 IF C>L GOTO 1830
1820 Z=L-C:Z=Z*Z:Z=Z+(R*R):Z=SQR(Z):GOTO 1840
1830 Z=C-L:Z=Z*Z:Z=Z+(R*R):Z=SQR(Z)
1840 PRINT "THE IMPEDANCE IS ";Z;" OHMS"
1850 GOTO 1940
1860 INPUT "RESISTANCE VALUE IN OHMS ? ";R
1870 INPUT "CAPACITANCE VALUE IN FARADS ? ";C
1880 INPUT "INDUCTANCE VALUE IN HENRYS ? ";L
1890 A=12/R:B=12/C:C=12/L
1900 IF B>C THEN X=B-C
1910 IF C>B THEN X=C-B
1920 T=A*A:X=X*X
1930 PRINT "THE IMPEDANCE IS ";12/(SQR(T+X));" OHMS"
1940 GOSUB 180:PRINT :GOTO 1740
1950 PRINT "THIS PROGRAM WILL CALCULATE ANTENNA LENGTH"
1960 INPUT "FREQUENCY IN MHZ ? ";F
1970 A=468/F:PRINT "THE HALF WAVE ANTENNA LENGTH IS ";A;" FEET";
1980 PRINT " OR ";:PRINT A*12;:PRINT " INCHES"
1990 PRINT "OPERATION WILL BE IN THE ";300/F;" METER BAND"
2000 GOSUB 180:PRINT :GOTO 1960
2010 PRINT "THIS PROGRAM WILL CALCULATE OHMS LAW"
2020 LINE INPUT "SOLVE FOR WHAT UNIT (E),(I), OR (R) ? ";U$
2030 IF U$="E"GOTO 2070
2040 IF U$="I"GOTO 2100
2050 IF U$="R"GOTO 2130
2060 GOTO 2020
2070 INPUT "CURRENT VALUE ? ";I
2080 INPUT "RESISTANCE VALUE ? ";R
2090 A=I*R:PRINT "THE VOLTAGE IS ";A:GOTO 2160
2100 INPUT "VOLTAGE VALUE ? ";E
2110 INPUT "RESISTANCE VALUE ? ";R
2120 A=E/R:PRINT "THE CURRENT IS ";A:GOTO 2160
2130 INPUT "VOLTAGE VALUE ? ";E
2140 INPUT "CURRENT VALUE ? ";I
2150 A=E/I:PRINT "THE RESISTANCE IS ";A
2160 GOSUB 180:PRINT :GOTO 2020
2170 PRINT "THIS PROGRAM WILL CALCULATE FOR POWER"
2180 INPUT "WHAT TWO UNITS (1)I&R, (2)E&R, (3)E&I ? ";U
2190 IF U=1 GOTO 2230
2200 IF U=2 GOTO 2250
2210 IF U=3 GOTO 2270
2220 GOTO 2180
2230 INPUT "VALUE OF I,R ? ";A,B
2240 PRINT "POWER EQUALS ";B*(A*A);" WATTS":GOTO 2290
2250 INPUT "VALUE OF E,R ? ";A,B
2260 PRINT "POWER EQUALS ";B/(A*A);" WATTS":GOTO 2290
2270 INPUT "VALUE OF E,I ? ";A,B
2280 PRINT "POWER EQUALS ";A*B;" WATTS"
2290 GOSUB 180:PRINT :GOTO 2180
2300 PRINT "THIS PROGRAM WILL CALCULATE THE RESISTOR COLOR CODE"
2310 LINE INPUT "FIRST COLOR ? ";C1$
2320 RESTORE :A=0:FOR X=1 TO 12
2330 READ Q$:IF Q$=C1$THEN A=A:GOTO 2360
2340 IF Q$="777"GOTO 2310
2350 A=A+10:NEXT X
2360 LINE INPUT "SECOND COLOR ? ";C2$
2370 RESTORE :B=0:FOR X=1 TO 12
2380 READ R$:IF R$=C2$THEN B=B:GOTO 2410
2390 IF R$="777"GOTO 2360
2400 B=B+1:NEXT X
2410 LINE INPUT "THIRD COLOR ? ";C3$
2420 IF C3$="GOLD"THEN C=.1:GOTO 2480
2430 IF C3$="SILVER"THEN C=.01:GOTO 2480
2440 RESTORE :C=1:FOR X=1 TO 12
2450 READ S$:IF S$=C3$THEN C=C:GOTO 2480
2460 IF S$="777"GOTO 2410
2470 C=C*10:NEXT X
2480 K=C*(A+B):PRINT "THE RESISTANCE IS ";K;" OHMS"
2490 S=K
2500 K=K/1000:PRINT "OR ";K;" KILO OHMS"
2510 K=K/1000:PRINT "OR ";K;" MEGA OHMS"
2520 K=K/1000:PRINT "OR ";K;" GIGA OHMS"
2530 PRINT "ENTRIES FOR NEXT QUESTION (NONE, SILVER, OR GOLD)"
2540 LINE INPUT "FOURTH COLOR ? ";C4$
2550 IF C4$="NONE"GOTO 2580
2560 IF C4$="SILVER"GOTO 2590
2570 IF C4$="GOLD"GOTO 2600
2580 M=.2*S:GOTO 2620
2590 M=9.999999E-02*S:GOTO 2620
2600 M=.05*S:GOTO 2620
2610 GOSUB 180:PRINT :GOTO 2310
2620 PRINT "THE RESISTOR TOLERANCE IS ";M
2630 PRINT "THE TOLERANCE RANGE IS ";S-M;" TO ";S+M;" OHMS":GOTO 2610
2640 PRINT "THIS PROGRAM WILL CALCULATE THE CHARACTERISTIC"
2650 PRINT "IMPEDANCE OF TRANSMISSION LINES"
2660 LINE INPUT "IS TRANSMISSION LINE TWO WIRE PARALLEL ? ";X$
2670 IF X$="YES"GOTO 2710
2680 LINE INPUT "IS TRANSMISSION LINE A COAXIAL LINE ? ";X$
2690 IF X$="YES"GOTO 2770
2700 PRINT :PRINT "TYPE 'YES' FOR ONE OF THE QUESTIONS":GOTO 2660
2710 PRINT :PRINT "PARALLEL TRANSMISSION LINE"
2720 INPUT "WHAT IS THE SPACING BETWEEN CONDUCTORS IN INCHES ? ";A
2730 INPUT "WHAT IS THE RADIUS OF ONE CONDUCTOR IN INCHES ? ";B
2740 Z=276*(LOG(A/B))
2750 PRINT :PRINT "THE IMPEDANCE IS ";Z;" OHMS"
2760 GOSUB 180:PRINT :GOTO 2660
2770 PRINT :PRINT "COAXIAL TRANSMISSION LINE"
2780 PRINT "WHAT IS THE INNER DIAMETER OF THE OUTER CONDUCTOR"
2790 INPUT "IN INCHES ? ";A
2800 PRINT "WHAT IS THE OUTER DIAMETER OF THE INNER CONDUCTOR"
2810 INPUT "IN INCHES ? ";B
282