User`s guide

Table Of Contents
160 Chapter 10
Communication with External Instruments Using Handler I/O Port
Sample Program
Sample Program
Example 10-1 provides a sample program that communicates with an external instrument
through the handler I/O port.You can find the source file of this program, named
hander.htb, on the sample program disk.
This program outputs 5 (sets bit 2 and bit 0 to Low, and the other bits to High) to the port A
of the handler I/O port, then waits until the bit 3 of the port C is set to Low.
The program is described in detail below:
Line 40 Assigns a GPIB address to the I/O pass.
Lines 60 to 70 These lines store the output data on the port A (binary) and bit location
(bit 3) into Out_data_bin$ and Flag_bit variables, respectively.
Line 90 This line configures the port C to input port.
Lines 100 to 110 These lines enable /INDEX and /READY FOR TRIGGER signals.
Lines 130 to 140 These lines convert Out_data_bin$ to a decimal value and set it to the
port A.
Lines 160 to 200 These lines repeat reading data from the port C until Flag_bit becomes
TRUE.
Example 10-1 Communicating with external instruments (handler.htb)
10 INTEGER Out_data,In_data,Bit_stat
20 DIM Out_data_bin$[9]
30 !
40 ASSIGN @Agte507x TO 717
50 !
60 Out_data_bin$="00000101"
70 Flag_bit=3
80 !
90 OUTPUT @Agte507x;":CONT:HAND:C:MODE INP"
100 OUTPUT @Agte507x;":CONT:HAND:IND:STAT ON"
110 OUTPUT @Agte507x;":CONT:HAND:RTR:STAT ON"
120 !
130 Out_data=IVAL(Out_data_bin$,2)
140 OUTPUT @Agte507x;":CONT:HAND:A ";Out_data
150 !
160 REPEAT
170 OUTPUT @Agte507x;":CONT:HAND:C?"
180 ENTER @Agte507x;In_data
190 Bit_stat=BIT(In_data,Flag_bit)
200 UNTIL Bit_stat=1
210 END