FAQs from Rohde & Schwarz

How to read the Scan Data from 30 MHz to 1 GHz?

Question

Answer

The following program defines a scan from 30 MHz to 1 GHz, starts it and writes all scan data in a file.

10 IEC TERM 10

20 IEC TIME 5000

25 REM The scan data will be stored in the file 'DATA.DAT'

30 OPENO# 1,"DATA.DAT"

35 REM The scan is defined in lines 40 to 200

40 IEC OUT 21,"*RST;*CLS;*OPC"

50 IEC OUT 21,"INSTRUMENT RECEIVER"

60 IEC OUT 21,"SCAN:RANGES 1"

70 IEC OUT 21,"FREQUENCY:START 30MHZ"

80 IEC OUT 21,"FREQUENCY:STOP 1GHZ"

90 IEC OUT 21,"DISPLAY:TRACE:Y:TOP 100"

100 IEC OUT 21,"DISPLAY:TRACE:Y:BOTTOM -20"

110 IEC OUT 21,"SWEEP:SPACING LINEAR"

120 IEC OUT 21,"DETECTOR:RECEIVER POSITIVE,AVERAGE"

130 IEC OUT 21,"SCAN1:START 30MHZ"

140 IEC OUT 21,"SCAN1:STOP 1GHZ"

150 IEC OUT 21,"SCAN1:STEP 50KHZ"

160 IEC OUT 21,"SCAN1:BANDWIDTH:RESOLUTION 120KHZ"

170 IEC OUT 21,"SCAN1:TIME 1MS"

180 IEC OUT 21,"SCAN1:INPUT:TYPE INPUT2"

190 IEC OUT 21,"SCAN1:INPUT:ATTENUATION:AUTO ON"

200 IEC OUT 21,"SCAN1:INPUT:GAIN:AUTO ON"

203 IEC OUT 21,"DISPLAY:FORMAT SINGLE"

205 REM We have to set the transfer format to real 32

210 IEC OUT 21,"FORMAT REAL,32"

220 IEC OUT 21,"*CLS"

225 REM We enable the transfer of scan data while the scan is running

230 IEC OUT 21,"TRACE:FEED:CONTROL ALWAYS"

235 REM The scan is started as a single scan

240 IEC OUT 21,"INITIATE2:CONTINUOUS OFF;*OPC"

250 IEC OUT 21,"INITIATE2:IMMEDIATE"

260 REPEAT

270 REPEAT

275 REM The bit 9 from STATUS:OPERATION:CONDITION is set when scan data

276 REM are available

280 IEC OUT 21,"STATUS:OPERATION:CONDITION?"

290 IEC IN 21,S$

300 UNTIL S$="512"

305 REM We get a scan block and store it in 'DATA.DAT'

310 IEC OUT 21,"TRACE? SCAN"

320 IEC IN 21,T$

330 PRINT# 1,T$

333 REM The scan block has a header. The first character is #. The second

334 REM character indicates the number of bytes that will follow with additional

335 REM information, eg 2. The additional information gives the number

336 REM of bytes which follow now with scan data, eg 32.

340 A=VAL(MID$(T$,2,1))+4

345 REM We will repeat the loop line 260 until bit 12 in the scan block

346 REM (without header) is set.

350 UNTIL MID$(BIN$(ASC(MID$(T$,A,2))),12,1)="1"

360 CLOSE# 1

365 REM Now the whole trace result is in the file 'DATA.DAT'

370 END