120 !

130DEF FNSettled(OPTIONAL Band, Rdgs.Timelimit)

140! BAND=SETTLING BAND IN VOLTS

150! RDGS=READINGS WITHIN BAND

160! TIMELIMIT=SETTLING TIME ALLOWED, SECONDS

170COM /Ps/ @Ps

180OUTPUT @Ps:”VSET?”

190ENTER @Ps;Vset

200SET TIMEDATE 2.1E+11

210!

220Band_p=.01

230Rdgs_p=2

240Timelimit_p=5

250Counter=0

260!

270IF NPAR>0 THEN Band_p=Band

280IF NPAR>l THEN Rdgs_p=Rdgs

290IF NPAR>2 THEN Timelimit_p=Timelimit

300!

310WHILE FNElapsed_time<Timelimit_p

320IF ABS(FNVout-Vset)<Band_p THEN

330 Counter=Counter+l

340IF Counter>=Rdgs p THEN RETURN l

350ELSE

360 Counter=0

370END IF

380END WHILE

390!

400RETURN 0

410FNEND

420!

430!

440DEF FNVout

450COM /Ps/ @Ps

460OUTPUT @Ps; “VOUT?”

470ENTER @Ps;Vout

480RETURN Vout

490FNEND

500!

510!

520DEF FNElapsed_time

530RETURN TIMEDATE-2.1E+11

540FNEND

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

Programming the Agilent 603xA Power Supplies Using Basic 117

Page 117
Image 117
Agilent Technologies 6038A 6010A, 6035A, 6028A, 6033A, 603xA, 6023A, 6031A, 6032A manual END While