Waiting for End of measurement

Other topics about Making Measurement

Using the Status Register

The status of the E5052B can be detected through the status registers. This section describes how to detect the end of measurement by using the status registers. For a complete description of the status report mechanism, including the specifications of each bit, see “Status Reporting System,”.

Measurement status is reported by the operation status condition register (see Opeartion Status Condition Register). An SRQ (service request) is useful when you create a program that uses the information reported by this register to detect the end of measurement.

To detect the end of measurement via an SRQ, use one of the following commands:

   *SRE

   :STATus:OPERation:ENABle

   :STATus:OPERation:PTRansition

   :STATus:OPERation:NTRansition

Follow these steps:

  1. Configure the E5052B so that it generates an SRQ when the operation status condition register's bit 4 (a bit that is set to 1 during measurement) is changed from 1 to 0.

  2. Trigger the instrument to start a measurement cycle.

  3. When an SRQ is generated, the program interrupts the measurement cycle.

SRQ generation sequence (at end of measurement)

Sample program

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

This program triggers the spectrum measurement of E5052B and then terminates the program when the end signal is received.

Sample program showing how to interrupt the end of measurement

110 DIM Buff$[9]

120 INTEGER A

130 ASSIGN @Agte5052 TO 717

140 OUTPUT @Agte5052;":ABOR"

150 OUTPUT @Agte5052;":TRIG:MODE SP1"

160 OUTPUT @Agte5052;":TRIG:SP:SOUR BUS"

170 OUTPUT @Agte5052;":INIT:SP:CONT ON"

180 OUTPUT @Agte5052;":STAT:OPER:PTR 0"

190 OUTPUT @Agte5052;":STAT:OPER:NTR 16"

200 OUTPUT @Agte5052;":STAT:OPER:ENAB 16"

210 OUTPUT @Agte5052;"*SRE 128"

220 OUTPUT @Agte5052;"*CLS"

230 OUTPUT @Agte5052;"*OPC?"

240 ENTER @Agte5052;Buff$

250 ON INTR 7 GOTO Meas_end

260 ENABLE INTR 7;2

270 OUTPUT @Agte5052;"*TRG"

280 PRINT "Waiting..."

290 Meas_wait: WAIT .1

300 OUTPUT @Agte5052;"*STB?"

310 ENTER @Agte5052;A

320 PRINT "a=";A

330 GOTO Meas_wait

340 Meas_end: OFF INTR 7

350 PRINT "Measurement Complete"

360 END

Using the *OPC? command

You can detect end of measurement by executing the *OPC? command or the *WAI command in your program. This section describes how to detect the end of measurement using the *OPC? command.

To enable the *OPC?, *WAI, and *OPC commands, you need to turn on these commands with the :TRIGger:SOPC.

   :TRIGger:SOPC

The following commands work differently when the :TRIG:SOPC command is turned on.

Com­mand

Operation when :TRIG:SOPC is on

Operation when :TRIG:SOPC is off

*OPC?

The processing of the program is suspended until the end of the measurement, and +1 is returned after the end of the measurement.

The control is returned to the program immediately without waiting for the end of the measurement.

*WAI

The processing of the program is suspended until the end of the measurement.

The control is returned to the program immediately without waiting for the end of the measurement.

*OPC

After the command is executed, the control is returned to the program without waiting for the end of the measurement. The Operation Completion bit of the Standard Event Status register is set after the end of measurement.

The control is returned to the program immediately without waiting for the end of the measurement. The Operation Completion bit of the Standard Event Status register is set without waiting for the end of measurement.

The processing of the program is suspended only during a transition period from “Waiting for Trigger” state to “Hold” state caused by the end of measurement or abortion of the measurement.

When the averaging trigger is on, the processing of the program is suspended until the “Hold” state occurs after all measurements for the averaging factor are completed.

Using Wait Time

Before creating your program, actually measure the time between the start and end of the measurement cycle. Then code your program so that the controller waits for the actually measured time by using the appropriate command (for example, the WAIT command for HTBasic). This is a straightforward method, but care must be taken: an incorrect wait time could result in unexpected error.