Introduction to Programming - 2

SCPI Command Completion

SCPI commands sent to the dc source are processed either sequentially or in parallel. Sequential commands finish execution before a subsequent command begins. Parallel commands allow other commands to begin executing while the parallel command is still executing. Commands that affect trigger actions are among the parallel commands.

The *WAI, *OPC, and *OPC? common commands provide different ways of indicating when all transmitted commands, including any parallel ones, have completed their operations. The syntax and parameters for these commands are described in chapter 4. Some practical considerations for using these commands are as follows:

*WAI

This prevents the dc source from processing subsequent commands until all pending

 

operations are completed.

*OPC?

This places a 1 in the Output Queue when all pending operations have completed.

 

Because it requires your program to read the returned value before executing the next

 

program statement, *OPC? can be used to cause the controller to wait for commands

 

to complete before proceeding with its program.

*OPC

This sets the OPC status bit when all pending operations have completed. Since your

 

program can read this status bit on an interrupt basis, *OPC allows subsequent

 

commands to be executed.

 

 

NOTE:

The trigger subsystem must be in the Idle state in order for the status OPC bit to be true.

 

Therefore, as far as triggers are concerned, OPC is false whenever the trigger subsystem

 

is in the Initiated state.

 

 

Using Device Clear

You can send a device clear at any time abort a SCPI command that may be hanging up the GPIB interface. The status registers, the error queue, and all configuration states are left unchanged when a device clear message is received. Device clear performs the following actions:

The input and output buffers of the dc source are cleared.

The dc source is prepared to accept a new command string.

The following statement shows how to send a device clear over the GPIB interface using Agilent BASIC:

CLEAR 705 IEEE-488 Device Clear

The following statement shows how to send a device clear over the GPIB interface using the GPIB command library for C or QuickBASIC:

IOCLEAR (705)

NOTE: For RS-232 operation, sending a Break will perform the same operation as the IEE-488 device clear message.

17