406
S:\agilent\8920\8920b\PRGGUIDE\BOOK\CHAPTERS\ibasic.fb
Chapter 7, IBASIC Controller
PROGram Subsystem
Example querying the value of a one dimensional array whose name is known but
whose current size is unknown
10 DIM Temp$[5000] !This will hold 250 numbers @ 20 characters each
20 DIM Result_array(500) !This array will hold up to 501 values
30 OUTPUT 714;"PROG:NUMB? Array" !Query the desired array
40 ENTER 714;Temp$ !Enter the values into a temporary string variable
50 N=-1 !Initialize array pointer, assume option base 0
60 REPEAT !Start loop to take values from string and put in array
70 N=N+1 !Increment array pointer
80 Pos_comma=POS(Temp$,",") !Find comma separator
90 Result_array(N)=VAL(Temp$[1,Pos_comma-1]) !Put value into array
100 Temp$=Temp$[Pos_comma+1] !Remove value from temporary string
110 UNTIL POS(Temp$,",")=0 !Check for last value in temporary string
120 Result_array(N+1)=VAL(Temp$) !Put last value into array
130 END
The above example assumes that the dimensioned size of the IBASIC array is small-
er than the dimensioned size of the array named Result_array.
NOTE: Individual array elements cannot be queried with the :NUMBer? command.
:STATe RUN|PAUSe|STOP|CONTinue
The STATe command is used to set, from
an external controller, the execution state of the IBASIC program in the Test Set.
Table 43 defines the effect of setting the execution state of the IBASIC program to
a desired state from each of the possible current states.
The program execution states are defined as follows:
• RUNNING, the program is currently executing.
• PAUSED, the program has reached a break in execution but can be continued.
• STOPPED, program execution has been terminated.
Table 43 Effect of STATe Commands
Desired State of
IBASIC Program
(STATe command sent
to Test Set)
Current State of IBASIC Program
RUNNING PAUSED STOPPED
RUN HP-IB Error: -221
Settings conflict
RUNNING RUNNING
CONT HP-IB Error: -221
Settings conflict
RUNNING HP-IB Error: -221
Settings conflict
PAUSE PAUSED PAUSED STOPPED
STOP STOPPED STOPPED STOPPED