Specifications

Chapter 7 155
Measurement Result Processing
Using Marker Function
7. Measurement Result
Processing
active marker (negative peak) position when a negative peak is found.
Line 910 Stops the execution of the macro.
Lines 950 - 1510 In the function program (peak_not_found), reads the marker search
results at the specified trace by using the questionable status marker
condition resistor. When marker search failure occurs, the bit on the
specified trace is set to 1and the function program returns a value of 1.
Example 7-2 Searching for a peak by using a marker (macro)
10 Sub Main()
20 Dim trc1 As Integer, trc2 As Integer, mkr1 As Integer, mkr2
As Integer
30 Dim sear_start As Double, sear_stop As Double
40 Dim delta_x As Double, delta_y As Double
50 Dim p_peak_x As Double, p_peak_y As Double
60 Dim n_peak_x As Double, n_peak_y As Double
70 Dim peak_found As Integer
80 Dim swp_bool As Integer, beak_query As Integer, bool As
Integer
90 Dim msg As String
100
110 trc1 = 1
120 trc2 = 2
130 mkr1 = 1
140 mkr2 = 2
150 sear_start = 100000000#
160 sear_stop = 1000000000#
170 delta_x = 1000000#
180 delta_y = 0.1
190
200 ' E4991A settings
210
220 SCPI.Output "SYST:PRES"
230
240 SCPI.Output "DISP:TRAC" & CStr(trc1) & " ON"
250 SCPI.Output "DISP:TRAC" & CStr(trc2) & " OFF"
260 SCPI.Output "CALC" & CStr(trc1) & ":FORM Z"
270 SCPI.Output "DISP:TRAC" & CStr(trc1) & ":SEL"
280
290 SCPI.Output "SWE:TYPE LOG"
300
310 SCPI.Output "TRIG:SOUR INT"
320 SCPI.Output "INIT:CONT OFF"
330 SCPI.Output "ABOR"
340
350 swp_bool = SCPI.Query("CALC:AVER?")
360 If swp_bool = 1 Then SCPI.Output "CALC:AVER:CLE"
370
380 bool = SingleMeasure
390 If bool = 0 Then
400 MsgBox ("Sweep Aborted")
410 ElseIf bool = 1 Then
420
430 SCPI.Output "DISP:TRAC" & CStr(trc1) & ":Y:AUTO"
440
450 SCPI.Output "CALC" & CStr(trc1) & ":MARK:AOFF"
460 SCPI.Output "CALC" & CStr(trc1) & ":MARK" & CStr(mkr1) &