Detecting End of Measurement

Other topics about Controlling E5052B

This section explains how to trigger the instrument to start a new measurement cycle and how to detect the end of a measurement cycle. For a detailed description of trigger detection, the trigger system, and the concept of triggering, refer to Making a Measurement.

You can detect the end of measurement by using either Using the Status Register or Using Event Interruption feature.

For the E5052B’s VBA, regardless of the setting of the SCPI.TRIG­ger.SOPC command, neither SCPI.IEEE4882.OPC nor SC­PI.IEEE4882.WAI can detect the end of measurement. Furthermore, the Parse command is not available.

Using the Status Register

The status of the E5052B can be monitored through the status register. For a complete description of the status report mechanism, including the specifications of each bit of the status register, refer to Status Reporting System.

If your program is based on SPCI commands, you can use SRQ (Service Request) interrupts to detect the end of measurement. For more information, refer to Waiting for the End of Measurement.

The following is a sample program that demonstrates how to use an SRQ to detect the end of measurement.

In this program, you can start a measurement cycle by pressing the command button on the user form (cmdExec), and a message box will appear when the measurement finishes.

Line 40

The trigger continuous mode is turned “OFF”

Lines 50 to 60

The trigger system switches to "Idle" state and clears the operation status event register.

Lines 70 to 80

These lines configure the instrument so that operation status event register’s bit 4 is set to 1 only when the operation status condition register’s bit 4 is changed from 1 to 0 (negative transition).

Lines 100 to 120

The trigger source is set to “Bus Trigger” to start a measurement cycle.

Lines 140 to 170

These lines repeat until the end of measurement is detected.

 Line 150

The control is returned to Windows so that other applications may be executed.

Line 190

A message box appears when the end of measurement is detected.

Example of    Using an Status Register to Detect the End of Measurement

10| Private Sub cmdExec_Click()

20| Dim i As Long

30|

40| SCPI.INITiate.SP.CONTinuous = False

50| SCPI.ABORt

60| SCPI.IEEE4882.CLS

70| SCPI.STATus.OPERation.PTRansition = 0

80| SCPI.STATus.OPERation.NTRansition = 16

90|

100| SCPI.TRIGger.SP.Source = "bus"

110| SCPI.INITiate.SP.CONTinuous = True

120| SCPI.IEEE4882.TRG

130|

140| Do While i = 0

150| DoEvents

160| i = SCPI.STATus.OPERation.EVENt

170| Loop

180|

190| MsgBox "end"

200|

210| End Sub

The E5052B’s VBA program is executed as a part of E5052B’s applications. Therefore, if any executed VBA program takes a long time before returning control to Windows, all processing operations other than VBA are suspend­ed during this time. To prevent this, use DoEvents to return the control to E5052B applications.

Using Event Interruption feature

The E5052B provides an event interruption feature to allow you to detect the end of measurement. By enabling the E5052B Event softkey, you can obtain an end of sweep event.

For details, refer to the section on Executing a Procedure with a Softkey (user menu function).

Interference between different interfaces

For the E5052B connected with two different interfaces (except for the VBA’s COM interface), for example, GPIB and LAN, while a controller is waiting for the end of measurement with *OPC? command or *WAI command through GPIB interface, LAN interface is unavailable until the measurement completes.

On the other hand, for the E5052B connected with two different interfaces, for example, GPIB and VBA, VBA’s COM interface is available, and commands can be executed even while a controller is waiting for the end of measurement with *OPC? command or *WAI command through GPIB interface. When the Parse command is executed, however, an error occurs.