Manual

P
ART
O
NE
:
ABOUT
REMOTE
CONTROL
20
ISSUED: February 2005
WM-RCM-E Rev D
When running this sample program, the X-Stream DSO will automatically be set to the remote state when
IBWRT is executed, and will remain in that state. Here is a slightly modified version of the sample program
that checks if any error occurred during GPIB operation:
GPIB: ‘ This line should hold the INCLUDE for the GPIB routines
Address: DEV$ = “DEV4”
Find: CALL IBFIND (DEV$, SCOPE%) ‘ Find the DSO.
Send: CMD$ = “TDIV?” ‘ Time base query
CALL IBWRT (SCOPE%, CMD$) ‘ Send the string to the DSO.
ErrorS: IF IBSTA% < 0 THEN PRINT “WRITE ERROR =” ; IBERR% : END
Read: CALL IBRD (SCOPE%, RD$) ‘ Try to read a string from the
DSO.
ErrorR: IF IBSTA% < 0 THEN PRINT “READ ERROR =” ; IBERR% : END
PRINT RD$
190 END
The GPIB status word IBSTA%, the GPIB error variable IBERR% and the count variable IBCNT% are
defined by the GPIB handler and are updated with every GPIB function call. IBSTA% is negative if there is an
error, while IBERR% shows what type of error has occurred. IBCNT% is the number of bytes transferred.
Refer to the National Instruments manual for details. The sample program above would report an error if the
GPIB address of the oscilloscope was set to a value other then 4. When you are sending remote commands to
the DSO, the IBSTA% and IBERR% don’t necessarily indicate that the scope accepted the string, but merely
that the string was correctly transmitted to the DSO to interpret. To ensure that commands were valid, and
weren’t rejected by the DSO, use the Remote Control Assistant.