HP (Hewlett-Packard) 6621A Power Supply User Manual


 
Programming with a Series 200/300 Computer99
10 ASSIGN @Ps TO 705
20 OUTPUT @Ps;"VSET?1''
30 ENTER @Ps;Vsl
40 OUTPUT @Ps;''ISET?1"
50 ENTER @Ps;Isl
60 PRINT ''VOLTAGE SETTING OF OUTPUT #1 = '';Vsl
70 PRINT ''CURRENT LIMIT SETTING OF OUTPUT #1 = ";Is1
80 END
Line 10: Assigns the I/O pathname to the power supply.
Line 20,30: Queries the supply for output 1's voltage setting. You cannot string multiple queries together in a single
device command because the power supply can only return the most recently queried data.
Line 40,50: Queries the supply for output 1's current limit.
Line 60,70: Prints the results of the queries on the screen.
Programming Power Supply Registers
Present Status
The power supply makes available several forms of status information. Chapter 5 discusses the different registers and their
functions. The present status register contains continuously updated information. The following example shows how to
query bit position 0 of output 1's status register to see if output 1 is in CV mode. In this example, the program references
the function as a variable in a conditional execution statement. Note that instead of printing a message, line 30 could be
used to branch to another part of the program in the event that the supply is in CV mode.
10 ASSIGN @Ps TO 705
20 COM /Ps/ @Ps
30 IF FNCv_mode THEN
40 PRINT "OUTPUT1 IS IN CV MODE"
50 END IF
60 END
70 !
80 !
90 DEF FNCv_mode
100 COM /Ps/ @Ps
110 OUTPUT @Ps;"STS?1"
120 ENTER @Ps;Sts
130 RETURN BIT(Sts,0)
140 FNEND
Line 10: Assigns the I/O path name to the power supply.
Line 20: Declare a common block for the I/O path name. The COM statement must be used for the @Ps variable to
preserve its value in the function subprogram.
Line 30,40,50: If FNCv_mode is true, print the message.
Line 90: Defines the Cv_mode function.
Line 100: Brings in the common block for the I/O pathname.
Line 110,120: Reads the present status of output 1 into the variable Sts.
Line 130: Returns the value of bit position 0 of Sts.
Service Request and Serial Poll
The fault and mask registers, when used in conjunction with the service request and serial poll functions, allow you to
select which conditions can cause computer interrupts. The fault and mask registers can also be used independently of the
serial poll or service request if so desired. The following example shows how to enable an interrupt to the computer in the
case of an overvoltage condition. After the interrupt has occurred, this example includes an interrupt routine that conducts