Agilent Technologies 6028A User Manual
Page 117
Programming the Agilent 603xA Power Supplies Using Basic
117
120
!
130
DEF FNSettled(OPTIONAL Band, Rdgs.Timelimit)
140 !
BAND=SETTLING BAND IN VOLTS
150 !
RDGS=READINGS WITHIN BAND
160 !
TIMELIMIT=SETTLING TIME ALLOWED, SECONDS
170
COM /Ps/ @Ps
180
OUTPUT @Ps:”VSET?”
190
ENTER @Ps;Vset
200
SET TIMEDATE 2.1E+11
210
!
220
Band_p=.01
230
Rdgs_p=2
240
Timelimit_p=5
250
Counter=0
260
!
270
IF NPAR>0 THEN Band_p=Band
280
IF NPAR>l THEN Rdgs_p=Rdgs
290
IF NPAR>2 THEN Timelimit_p=Timelimit
300
!
310
WHILE FNElapsed_time 320 IF ABS(FNVout-Vset) 330 Counter=Counter+l 340 IF Counter>=Rdgs p THEN RETURN l 350 ELSE 360 Counter=0 370 END IF 380 END WHILE 390 ! 400 RETURN 0 410 FNEND 420 ! 430 ! 440 DEF FNVout 450 COM /Ps/ @Ps 460 OUTPUT @Ps; “VOUT?” 470 ENTER @Ps;Vout 480 RETURN Vout 490 FNEND 500 ! 510 ! 520 DEF FNElapsed_time 530 RETURN TIMEDATE-2.1E+11 540 FNEND Explanation: 10: Assign I/O path name for power supply 20: Declare common block for I/O path name 30: Clear power supply, set voltage to 20 Volts, current limit to 2 Amps 50: Downprogram power supply to 100 mV 60: Format statement for display 70,90: If P.S. output has settled to within 20 mV of programmed value (for 5 consecutive readings) print message 130: Define FN settled. (optional parameters described in lines 140-160) 170: Bring in common block for I/O path name 180,190: Read set value for voltage into VSET 200: Initialize real time clock in computer 220-250: Assign default values to variables corresponding to elements in parameter list. (Cannot reference optional parameters in context if not passed in parameter list.) 270-290: If parameters are passed, assign values to corresponding subprogram variables 310-380: Repeat 320-370 until time limit is reached 320-330: If absolute value of output voltage (-Set voltage is within settling band) increment counter 340: If counter=Desired number of readings within band, return 1 360: If voltage left setting band, reset counter 400: If time has elapsed, return 0 440-490: Function reads and returns output voltage 520-540: Function returns time elapsed since real time clock was initialized on line 200