Agilent Technologies 66311B Portable Generator User Manual


 
Example Programs - D
167
1225 ’
1230 ’Clear status circuit
1235 CODES$="*CLS" :GOSUB 2000
1240 FOR I=1 TO 50 :NEXT I ’Wait for supply to clear
1245 ’
1250 ’Disable output and save present state to location 2
1255 CODES$ = "OUTPUT OFF;*SAV 2" :GOSUB 2000
1260 END
1265 ’
2000 ’Send command to dc source
2005 CALL IBWRT(PS%,CODES$)
2010 IF IBSTAT%
2015 RETURN
1250 ’Disable output and save present state to location 2
1255 CODES$ = "OUTPUT OFF;*SAV 2" :GOSUB 2000
1260 END
1265 ’
2000 ’Send command to dc source
2005 CALL IBWRT(PS%,CODES$)
2010 IF IBSTAT%
2015 RETURN
2020 ’
2100 ’Error detection routine
2105 PRINT "GPIB error. IBSTAT% = HEX$(IBSTAT%)
2110 PRINT " IBERR% = ";IBERR%" in line ";ERL
2115 STOP
2120 ’
3000 ’Get data from dc source
3005 CALL IBRD(PS%,OUTPUT$)
3010 IF IBSTA%
3015 I=1 ’Parse data string
3020 X=1
3025 C=INSTR(I,OUTPUT$,";")
3030 WHILE C <> 0
3035 D$=MID$(OUTPUT$,I,C-I)
3040 OUTPUT(X)=VAL(D$) ’Get values
3045 I=C+1
3050 C=INSTR(I,OUTPUT$,";")
3055 X=X+1
3060 WEND
3065 D$=RIGHT$(OUTPUT$,LEN(OUTPUT$)-(I-1))
3070 OUTPUT(X)=VAL(D$)
3075 OUTPUT$=SPACE$(40) ’Clear string
3080 RETURN