home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / freq / interfer / interfer.bas next >
BASIC Source File  |  1986-11-21  |  6KB  |  141 lines

  1. 100 '   Receiver Interference Analysis Program:  INTERFER.BAS
  2. 101 '
  3. 102 '
  4. 103 '
  5. 104 '   Designed for determining possible receiver interference by testing for
  6. 105 '   sum,  difference, and first through third harmonic matches through out
  7. 106 '   both  transmit  and  receive  bandpass.   Matches are tested for seven 
  8. 107 '   receiver  parameters:  receive freq, two  IF  stages and their images,
  9. 108 '   and two  LO  frequencies.  No signal strength considerations are made.
  10. 109 '
  11. 110 '
  12. 111 '   By Robert L. Chamberlin
  13. 112 '   United Technimedia Inc.
  14. 113 '   Park City, Utah
  15. 114 '
  16. 115 '
  17. 116 '   Define vars and consts
  18. 117 DIM F(200),B(200),A(6,10,2),C(15)
  19. 118 DEFSTR Z
  20. 119 Z(0)="receiver frequency"
  21. 120 Z(1)="receiver 1st IF"
  22. 121 Z(2)="receiver 1st IF image"
  23. 122 Z(3)="receiver 2nd IF"
  24. 123 Z(4)="receiver 2nd IF image"
  25. 124 Z(5)="receiver 1st LO"
  26. 125 Z(6)="receiver 2nd LO"
  27. 126 Z(7)="Frequency"
  28. 127 Z(8)="Sum"
  29. 128 Z(9)="Difference"
  30. 129 '
  31. 130 '
  32. 131 '   Action menu
  33. 132 CLS:PRINT:PRINT"      [1]  Use existing transmitter frequency data base"
  34. 133 PRINT"      [2]  Start a new data base (write over previous if existing)"
  35. 134 PRINT"      [3]  Add to the existing data base"
  36. 135 INPUT "Enter selection";Q:ON Q GOTO 136, 146, 136:GOTO 135
  37. 136 '
  38. 137 '
  39. 138 '   Read data from disk files
  40. 139 OPEN "I",#1,"TRANS.DAT"
  41. 140 INPUT#1,F(I),B(I):PRINT F(I)"mHz",2*B(I)"mHz"
  42. 141 IF EOF(1) THEN CLOSE:GOTO 142 ELSE I=I+1:GOTO 140
  43. 142 N=I+1:IF Q=3 THEN 146 ELSE 164
  44. 143 '
  45. 144 '
  46. 145 '   Get transmitter parameters
  47. 146 PRINT"Enter each transmitter freq. and bandwidth to be tested (0 to end)
  48. 147 PRINT"NOTE:  ALL FREQUENCIES AND BANDWIDTHS MUST BE ENTERED IN MHZ
  49. 148 Q$="":PRINT:INPUT "Frequency (mHz)";F(N)
  50. 149 IF F(N)=0 THEN INPUT "Are all transmit frequencies entered";Q$:ELSE 152
  51. 150 IF Q$="y" OR Q$="Y" OR Q$="" THEN 158
  52. 151 ELSE IF Q$="n" OR Q$="N" THEN 154
  53. 152 INPUT "Bandwidth (mHz)";B(N):B(N)=B(N)/2:IF B(N)<.01 THEN B(N)=.01
  54. 153 Q$="":INPUT "OK";Q$
  55. 154 IF Q$="n" OR Q$="N" THEN PRINT "REDO THIS ENTRY":GOTO 148
  56. 155 N=N+1:GOTO 148
  57. 156 '
  58. 157 '
  59. 158 '   Write transmiter data base to file
  60. 159 OPEN "O",#1,"TRANS.DAT"
  61. 160 FOR I=0 TO N-1:WRITE#1,F(I),B(I):NEXT I:CLOSE
  62. 161 '
  63. 162 '
  64. 163 '   Get receiver parameters
  65. 164 PRINT:INPUT "Receiver frequency (mHz)";RF
  66. 165 INPUT "Receiver first IF (mHz)";I1
  67. 166 L1=RF-I1:' calc first LO freq 
  68. 167 INPUT "Receiver second IF (mHz)";I2
  69. 168 L2=I1-I2:' calc 2nd LO freq
  70. 169 INPUT "Receiver bandwidth (mHz)";RB:RB=RB/2:IF RB<.01 THEN RB=.01
  71. 170 Q$="":INPUT "OK";Q$:IF Q$="n" OR Q$="N" THEN PRINT "REDO ENTRY":GOTO 164
  72. 171 C(1)=RF-RB:C(2)=RF+RB:' receiver frequency min and max
  73. 172 C(3)=RF-L1-RB:C(4)=RF-L1+RB:' min and max 1st IF
  74. 173 C(5)=RF+L1-RB:C(6)=RF+L1+RB:' min and max 1st IF image
  75. 174 C(7)=I1-L2-RB:C(8)=I1-L2+RB:' min and max 2nd IF
  76. 175 C(9)=I1+L2-RB:C(10)=I1+L2+RB:' min and max 2nd IF image
  77. 176 C(11)=L1-RB:C(12)=L1+RB:' 1st LO +- bw for beat
  78. 177 C(13)=L2-RB:C(14)=L2+RB:' 2nd LO +- bw for beat
  79. 178 IF I2=0 THEN C(7)=0:C(8)=0:C(9)=0:C(10)=0:C(13)=0:C(14)=0
  80. 179 '
  81. 180 '   Print receiver and frequency data
  82. 181 LPRINT:LPRINT TAB(25) "Receiver Interference Analysis":LPRINT:LPRINT:LPRINT
  83. 182 LPRINT "Receiver Parameters:":LPRINT
  84. 183 LPRINT TAB(41) "Minimum" TAB(61) "Maximum"
  85. 184 LPRINT"Receiver Frequency" TAB(20) RF TAB(40) C(1) TAB(60) C(2)
  86. 185 LPRINT "First IF" TAB(40) C(3) TAB(60) C(4)
  87. 186 LPRINT "First IF Image" TAB(40) C(5) TAB(60) C(6)
  88. 187 LPRINT "Second IF"TAB(40) C(7) TAB(60) C(8)
  89. 188 LPRINT "Second IF Image" TAB(40) C(9) TAB(60) C(10)
  90. 189 LPRINT "First LO" TAB(40) C(11) TAB(60) C(12)
  91. 190 LPRINT "Second LO" TAB(40) C(13) TAB(60) C(14)
  92. 191 LPRINT:LPRINT:LPRINT "Frequency Data:":LPRINT:LC=25
  93. 192 LPRINT "Frequency" TAB(18) "Bandwidth" TAB(41) "Minimum" TAB(61) "Maximum"
  94. 193 FOR I=0 TO N-1:LPRINT USING "####.###";F(I);:LPRINT TAB(20);
  95. 194 LPRINT USING "##.###";B(I)*2;:LPRINT TAB(40);
  96. 195 LPRINT USING "####.###";F(I)-B(I);:LPRINT TAB(60);
  97. 196 LPRINT USING "####.###";F(I)+B(I):LC=LC+1
  98. 197 IF LC>60 THEN LPRINT CHR$(12);:LC=0:' execute form feed at line 60
  99. 198 NEXT I:LPRINT CHR$(12):LPRINT TAB(25) "Receiver Interference Analysis"
  100. 199 LPRINT:LPRINT:LPRINT "Freq. 1","Freq. 2" TAB(40) "Interference Product"
  101. 200 LPRINT:LC=12
  102. 201 FOR H=1 TO 3
  103. 202 IF ABS(RF-L1*H)<RB OR ABS(RF-L2*H)<RB THEN LPRINT TAB(30) "Receiver LO harmonic to rec freq (harmonic"H")":LC=LC+1
  104. 203 IF ABS(I1-L1*H)<RB OR ABS(I2-L2*H)<RB THEN LPRINT TAB(30) "Receiver LO harmonic to the IF (Harmonic"H")":LC=LC+1
  105. 204 NEXT H
  106. 205 '
  107. 206 '
  108. 207 '   Compute cross mod and harmonic products
  109. 208 FOR I=0 TO N-1:' get f1
  110. 209 A1=F(I)-B(I):A2=F(I)+B(I):' get f1 spectrum
  111. 210 FOR J=I+1 TO N:' get f2
  112. 211 A3=F(J)-B(J):A4=F(J)+B(J):PRINT F(I),F(J)' get f2 spectrum
  113. 212 FOR R=1 TO 13 STEP 2:' index receiver parameter array
  114. 213 FOR H=1 TO 3:' harmonic and array increment
  115. 214 A(1,H,0)=A1*H:A(1,H,1)=A2*H:' frequency f1 min and max and harmonics
  116. 215 A(2,H,0)=(A1+A3)*H:A(2,H,1)=(A2+A4)*H:' sum f1 and f2 (min and max)
  117. 216 A(3,H,0)=ABS(A1-A3)*H:A(3,H,1)=ABS(A2-A4)*H:' diff f1 and f2 (min and max)
  118. 217 '
  119. 218 '
  120. 219 '   Test for interference
  121. 220 FOR F=1 TO 3:' increment array sum, diff, freq
  122. 221 '  PRINT A(F,H,0);A(F,H,1);C(R);C(R+1);:' delete rem to view test freq
  123. 222 IF C(R+1)=>A(F,H,0) AND A(F,H,1)=>C(R) THEN GOSUB 231
  124. 223 NEXT F:' next sum, diff, freq
  125. 224 NEXT H:' next harmonic
  126. 225 NEXT R:' index receiver parameter array
  127. 226 NEXT J:' next freq f2
  128. 227 FF=0:NEXT I:' next frequency f1 and reset freq used flag
  129. 228 LPRINT"TEST COMPLETE" CHR$(12);:RESET:END
  130. 229 '
  131. 230 '
  132. 231 '   Print interference data subroutine
  133. 232 IF F(J)=0 OR (FF=1 AND F=1 AND H=1) THEN RETURN ELSE LPRINT USING "####.###"; F(I);
  134. 233 IF F>1 THEN LPRINT TAB(13);:LPRINT USING "####.###"; F(J);:GOTO 235
  135. 234 FF=1:'  set frequency used flag
  136. 235 LPRINT TAB(30) Z(6+F) " to ";
  137. 236 LPRINT Z(INT(R-1)/2);:IF H>1 THEN LPRINT " ( Harmonic" H ")"
  138. 237 IF H=1 THEN LPRINT " ( Fundamental )"
  139. 238 IF LC>60 THEN LPRINT CHR$(12):LC=8:LPRINT:LPRINT
  140. 239 LC=LC+1:RETURN
  141.