User`s manual

16 Getting Started
Chapter 1
Initial Operation
Use the following example to verify initial operation. The example first sets
and then queries the polarity of a logical true condition on the port 0 FLG
line. The example uses an HP Series 200/300 Computer with BASIC as the
programming language. The computer is connected to an Agilent E1301
Mainframe using the General Purpose Interface Bus (GPIB)*. The GPIB
interface select code is 7, the GPIB primary address is 09, and the GPIB
secondary address (used to specify the Digital I/O module) is 18. Refer to
the B-Size Installation and Getting Started Guide for more details.
10 ASSIGN @Dio TO 70918
!Sets an I/O path to the module.
20 DIM Polarity$[3]
30 OUTPUT @Dio;"*RST"
!Reset the module.
40 OUTPUT @Dio;"*OPC?"
!Wait for the module to finish.
50 ENTER @Dio;Ready !Hold here until command is
finished.
60 OUTPUT @Dio;"SOUR:DIG:FLAG0:POL POS;*OPC?"
!Set POSitive polarity.
70 ENTER @Dio;Ready
!Wait for finish.
80 OUTPUT @Dio;"SOUR:DIG:FLAG0:POL?"
!Query the polarity state.
90 ENTER @Dio;Polarity$
!Get the result.
100 IF Polarity$ <> "POS" THEN
!Check the result.
110 DISP "Polarity Check ERROR" !Error discovered.
120 PAUSE !Pause on error.
130 ELSE
140 DISP"Polarity set to "&Polarity$
150 END IF
160 OUTPUT @Dio;"SOUR:DIG:FLAG0:POL NEG;*OPC?"
!Set NEGative polarity.
170 ENTER @Dio;Ready
!Wait for finish.
180 OUTPUT @Dio;"SOUR:DIG:FLAG0:POL?"
!Query the polarity state.
190 ENTER @Dio;Polarity$
!Get the result.
200 IF Polarity$ <> "NEG" THEN
!Check the result.
210 DISP "Polarity Check ERROR"
!Error discovered.
220 PAUSE
!Pause on error.
230 ELSE
240 DISP"Polarity set to "&Polarity$
250 END IF
260 OUTPUT @Dio;"*RST"
!Restore the module.
270 OUTPUT @Dio;"*OPC?" !Wait for the module to finish.
280 ENTER @Dio;Ready
290 END
* GPIB is the implementation of IEEE Std 488.1-1984.