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