home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
ant
/
smith
/
smith.bas
next >
Wrap
BASIC Source File
|
1986-01-24
|
4KB
|
71 lines
10 CLEAR:DEF SEG:KEY OFF:DEFINT I,J,K,M,N: FALSE = 0:TRUE = NOT FALSE:CLS:COLOR 7,0
20 PRINT STRING$(40,"#");:LOCATE 2,1: PRINT"#"TAB(40)"#"
30 PRINT "# DIGITAL SMITH CHART by AA4L";:LOCATE ,40:PRINT "#"
40 PRINT"#"TAB(40)"#":PRINT "# October 8th 1982"TAB(40)"#"
50 PRINT"#" TAB(40) "#":PRINT "# Public Domain" TAB(40)"#"
60 PRINT "#" TAB(40) "#":PRINT STRING$(40,"#")
62 PRINT :PRINT :COLOR 15,0:PRINT "Note: Calculations are TOWARDS GENERATOR FROM KNOWN POINT!!"
63 PRINT "Values TOWARD LOAD may be derived by analyzing data backwards from"
64 PRINT "the point 180 degrees from the known point.":COLOR 7,0
70 PRINT :PRINT :BEEP:PRINT "Any Key"
80 ANY$=INKEY$: IF ANY$="" THEN GOTO 80
90 CLS
100 BEEP:INPUT "Line Z0 {default is 50}==> ";Z0:IF Z=0 THEN Z0=50
110 BEEP:PRINT :INPUT "Known R ==> ";R0
120 BEEP:PRINT :INPUT "Known X===> ";X0
130 BEEP:PRINT :INPUT "Calculation start at: (deg) {default 0} ";STRT
140 BEEP:PRINT :INPUT "Calculation end at: (deg) {default 180} ";ENDC:IF ENDC =0 THEN ENDC =180 ELSE IF ENDC > 180 THEN ENDC=180
150 BEEP:PRINT:INPUT "Calculation interval (deg) {default 10} ";DINTV: IF DINTV=0 THEN DINTV =10
160 BEEP:PRINT :INPUT "Frequency (mHz) {default is 7.15} ==> ";FREQ: IF FREQ=0 THEN FREQ=7.15
165 BEEP:PRINT :INPUT"Velocity factor {default 0.66} ==> ";VF:IF VF=0 THEN VF=.66
170 BEEP:PRINT:INPUT "Hardcopy (y/n) {default no} ";PRT$: IF PRT$="y" OR PRT$ ="Y" THEN PRT = TRUE ELSE PRT = FALSE
175 IF PRT THEN GOTO 2000
180 GOSUB 1000
200 R0=R0/Z0:X0=X0/Z0
300 FOR THETA = STRT TO ENDC STEP DINTV
310 THETA1 =THETA: IF THETA1 >89.99 AND THETA1 <=90 THEN THETA1=89.99
320 IF THETA1<90.00999 AND THETA1 => 90 THEN THETA1 = 90.00999
330 TN=TAN(THETA1*3.141592654#/180)
340 R=Z0*R0*(1+TN*TN)/((1-X0*TN)*(1-X0*TN)+(R0*TN)*(R0*TN))
350 X=Z0*(X0*(1-TN*TN)+(1-(R0*R0)-(X0*X0))*TN)/((1-X0*TN)*(1-X0*TN)+(R0*TN)*(R0*TN))
352 IF R>9999 THEN R=9999
353 IF X>9999 THEN X=9999
354 IF X<-9999 THEN X=-9999
360 G=R/(R*R + X*X):B= -X/(R*R + X*X)
361 IF G>9.999001 THEN G=9.999001
362 IF B>9.999001 THEN B=9.999001
365 IF PRT GOTO 375
370 PRINT SPC(2);:PRINT USING"###.#";THETA;:PRINT SPC(2)"|"SPC(4);:PRINT USING"#####.##";R;:PRINT SPC(2)"|"SPC(4);:PRINT USING"#####.##";X;:PRINT SPC(2)"|"SPC(7);:PRINT USING"#.###";G;:PRINT SPC(2)"|"SPC(6);:PRINT USING"#.###";B;:PRINT SPC(2)"|";
371 GOTO 380
375 LPRINT SPC(2);:LPRINT USING"###.#";THETA;:LPRINT SPC(2)"|"SPC(4);:LPRINT USING"#####.##";R;:LPRINT SPC(2)"|"SPC(4);:LPRINT USING"#####.##";X;:LPRINT SPC(2)"|"SPC(7);:LPRINT USING"#.###";G;:LPRINT SPC(2)"|"SPC(6);:LPRINT USING"#.###";B;
376 LPRINT SPC(2)"|";
380 LENG=(THETA/(.367*FREQ))*VF:LENGFT=INT(LENG):LENGIN=12*(LENG-LENGFT)
385 IF PRT GOTO 395
390 PRINT SPC(1);:PRINT USING"###";LENGFT;:PRINT"'";:PRINT USING "##.#";LENGIN;:PRINT CHR$(34)
391 GOTO 400
395 LPRINT SPC(1);:LPRINT USING"###";LENGFT;:LPRINT"'";:LPRINT USING "##.#";LENGIN;:LPRINT CHR$(34)
396 GOTO 500
400 IF CSRLIN<24 THEN GOTO 500
410 BEEP
420 WT$=INKEY$:IF WT$="" THEN GOTO 420
430 CLS:GOSUB 1000
500 NEXT
505 IF PRT THEN GOTO 530
510 BEEP:PRINT :PRINT "any key":
520 WT$=INKEY$:IF WT$=""THEN GOTO 520
530 R0=R0*Z0:X0=X0*Z0:RHO=SQR(((R0-Z0)*(R0-Z0)+X0*X0)/((Z0+R0)*(Z0+R0)+X0*X0)):SWR=(1+RHO)/(1-RHO)
535 IF PRT THEN GOTO 545
540 CLS: PRINT"Freq ==> ";FREQ:PRINT :PRINT "rho ==> ";:PRINT USING"#.###";RHO:PRINT:PRINT"vswr ==> ";:PRINT USING"##.##";SWR
541 GOTO 550
545 LPRINT:LPRINT"Freq ==> ";FREQ:LPRINT :LPRINT "rho ==> ";:LPRINT USING"#.###";RHO:LPRINT:LPRINT"vswr ==> ";:LPRINT USING"##.##";SWR
546 LPRINT CHR$(12)
550 BEEP:PRINT:PRINT"Again? (y/n)"
560 YN$=INKEY$:IF YN$=""THEN GOTO 560 ELSE IF YN$="y" OR YN$="Y" THEN GOTO 90 ELSE CHAIN "MENUB.BAS"
999 CHAIN "MENUB.BAS"
1000 CLS:COLOR 0,7:PRINT SPACE$(80);:LOCATE 1,1
1010 PRINT TAB(3) "Deg" TAB(10) "| R" TAB(25) "| X" TAB(40) "| G" TAB(55) "| B" TAB(69) "| Length":COLOR 7,0
1020 RETURN
1999 CHAIN "MENUB.BAS"
2000 LPRINT TAB(3) "Deg" TAB(10) "| R" TAB(25) "| X" TAB(40) "| G" TAB(55) "| B" TAB(69) "| Length"
2010 LPRINT STRING$ (80,"*");:GOTO 200