Programming Examples
R&S
®
ZNB/ZNBT
1210
User Manual 1173.9163.02 ─ 38
been implemented for overlapped execution. The advantage of overlapped commands
is that they allow the program to do other tasks while being executed.
In the present example the sweep must be completed before measurement results can
be retrieved. To prevent wrong results (e.g. a mix-up of results from consecutive
sweeps) the controller must synchronize its operation to the execution of
INITiate<Ch>[:IMMediate]
. IEEE 488.2 defines three common commands (
*WAI
,
*OPC?
,
*OPC
) for synchronization.
// 1. Start single sweep, use *WAI
// *WAI is the easiest method of synchronization. It has no effect when sent
// after sequential commands.
// If *WAI follows INITiate<Ch>[:IMMediate]... (overlapped commands), the analyzer
// executes no further commands or queries until the sweep is terminated.
// *WAI does prevent the controller from sending other commands to the analyzer
// or other devices
// Start single sweep in channel no. 1, wait until the end of the sweep
INITiate1:IMMediate; *WAI
<Continue program sequence>
// 2. Start single sweep, use *OPC?
// If *OPC follows INITiate<Ch>[:IMMediate]..., it places a 1 into the
// output queue when the sweep is terminated.
// An appropriate condition in the remote control program must cause the
// controller to wait until *OPC? returns one.
// The controller is stopped from the moment when the condition is set.
// Start single sweep in channel no. 1, indicate the end of the sweep
// by a 1 in the output queue.
INITiate1:IMMediate; *OPC?
// So far the controller may still send messages to other connected devices.
// Stop the controller until *OPC? returns one (program syntax depends
// on your programming environment).
<Condition OPC=1>
<Continue program sequence>
// 3. Start single sweep, use *OPC
// If *OPC follows INITiate<Ch>[:IMMediate]..., it sets the OPC bit in the ESR
// after the sweep is terminated.
// This event can be polled or used to trigger a service request of the analyzer.
// The advantage of *OPC synchronization is that both the controller and the
// analyzer can continue processing commands while the sweep is in progress.
// Enable a service request for the ESR
*SRE 32
// Set event enable bit for operation complete bit
Basic Tasks