183
────────────────────────────────────────────────────
8.6 Sample Programs
────────────────────────────────────────────────────
8.6.1 GP-IB
10 DIM A$[100]
20 CLEAR 701
30 OUTPUT 701;"*RST"
40 OUTPUT 701;":TRAN:TERM 1"
50 OUTPUT 701;":VOLT:AUTO OFF;RANGE 300"
60 OUTPUT 701;":CURR:AUTO OFF;RANGE 20"
70 OUTPUT 701;":SCALE:PT 1;CT 1;SC 1"
80 OUTPUT 701;":RECT 1"
90 OUTPUT 701;":INTEG:TIME 1,0,0"
100 OUTPUT 701;"*ESE 0;*SRE 0"
110 OUTPUT 701;":ESE0 32;:ESE1 0;:ESE2 0"
120 OUTPUT 701;":DATA:TIME 0,1,0;ITEM 7,9"
130 OUTPUT 701;"*CLS"
140 OUTPUT 701;":INTEG:STAT START"
150 OUTPUT 701;"*STB?"
160 ENTER 701;A$
170 IF A$<>"1" THEN GOTO 150
180 OUTPUT 701;":MEAS?"
190 ENTER 701;A$
200 PRINT A$
210 OUTPUT 701;":INTEG:STAT?"
220 ENTER 701;A$
230 IF A$=":INTEGRATE:STATE STOP" THEN GOTO 260
240 OUTPUT 701;"*CLS"
250 GOTO 150
260 OUTPUT 701;":INTEG:STAT RESET"
270 END
8.6 Sample Programs
As examples of interface, shows sample programs.
The contents of programs: Setting of range, scaling and rectifier type and
displaying to get integrate elapsed time and integrate value at regular
intervals (a minute at this point).
The sample programs of GP-IB and RS-232C are the same contents.
The sample programs of GP-IB are written in HP-BASIC (by Hewlett
Packard) and of RS-232C are written in Quick BASIC (by Microsoft).
Setting condition
Voltage 300 V range
Current 20 A range
PT ratio 1
CT ratio 1
Rectifier type RMS
Integration time 1 hour
Data output interval 1 minute
Program list Program comments
10 Declare character arrays
20 Initialize the GP-IB interface
30 Initialize the 3332
40 Set delimiter to "CR+LF"
50 Set ranges to 300 V
60 Set ranges to 20 A
70 Set PT ratio to 1, CT ratio to 1, SC to 1
80 Set rectifier type to "RMS"
90 Set integration time to an hour
100 Invalidate ESE and SRE
110 Validate only bit 5 (OT) of ESE0
120 Set data output time to one minute, output
item to (V,A,W,WH,TIME)
130 Clear event registers
140 Start integration
150 Query contents of status byte
160 Get contents of status byte
170 Branches to line 160 when "OT" flag is not
raised
180 Query integrate value data for output item
190 Get data
200 Display data
210 Query integrate condition
220 Get integrate condition
230 Branches to line 270 when integration stops
240 Clear event registers
250 Branches to line 160
260 Reset integrate value
270 End of program