Specifications

Chapter 6 137
Read and Write Measurement Data
Example Programs for Reading Internal Data Arrays
6. Read and Write
Measurement Data
40 Dim start_bias As Double, stop_bias As Double, lim_bias As
Double
50 Dim cw_freq As Double, osc_level As Double
60 Dim trc1 As Integer, trc2 As Integer, nop As Integer,
swp_count As Integer
70 Dim i As Integer, swp_bool As Integer, bool As Integer
80 Dim fileNum As Integer
90 Dim file As String
100
110 trc1 = 1
120 trc2 = 2
130 start_bias = 0
140 stop_bias = 40
150 lim_bias = 0.05
160 nop = 41
170 swp_count = 1
180 cw_freq = 100000000#
190 osc_level = 0.1
200
210 ' E4991A settings
220
230 SCPI.Output "SYST:PRES"
240
250 SCPI.Output "DISP:TRAC" & CStr(trc1) & " ON"
260 SCPI.Output "DISP:TRAC" & CStr(trc2) & " OFF"
270 SCPI.Output "CALC" & CStr(trc1) & ":FORM Z"
280
290 SCPI.Output "SWE:TYPE DCV"
300 SCPI.Output "SOUR:VOLT:OFFS:STAR " & CStr(start_bias)
310 SCPI.Output "SOUR:VOLT:OFFS:STOP " & CStr(stop_bias)
320 SCPI.Output "SOUR:CURR:LIM:OFFS " & CStr(lim_bias)
330 SCPI.Output "SWE:POIN " & CStr(nop)
340 SCPI.Output "SWE:DIR UP"
350 SCPI.Output "CALC:AVER:COUN " & CStr(swp_count)
360 SCPI.Output "CALC:AVER ON"
370
380 SCPI.Output "FREQ " & CStr(cw_freq)
390 SCPI.Output "SOUR:VOLT:MODE FIX"
400 SCPI.Output "SOUR:VOLT " & CStr(osc_level)
410
420 SCPI.Output "SOUR:VOLT:OFFS:STAT ON"
430 SCPI.Output "CALC" & CStr(trc1) & ":MARK1 ON"
440 SCPI.Output "CALC:BMON ON"
450
460 SCPI.Output "TRIG:SOUR INT"
470 SCPI.Output "INIT:CONT OFF"
480 SCPI.Output "ABOR"
490
500 swp_bool = SCPI.Query("CALC:AVER?")
510 If swp_bool = 1 Then SCPI.Output "CALC:AVER:CLE"
520
530 bool = SingleMeasure
540 If bool = 0 Then
550 MsgBox ("Sweep Aborted")
560 ElseIf bool = 1 Then
570 SCPI.Output "FORM:DATA ASC"
580
590 SCPI.Output "CALC" & CStr(trc1) & ":DATA? FDATA"