Agilent Part No. 5964-8269 Printed in Malaysia
Microfiche Part No. 5964-8270 July, 2001
Safety Guidelines
The beginning of the power supply Operating Manual has a Safety Summary page. Be sure you are familiar with the
information on that page before programming the power supply for operation from a controller.
ENERGY HAZARD. Power supplies with high output currents (such as the Series 668xA/669xA)
can provide more than 240 VA at more than 2 V. If the output connections touch, severe arcing may
occur resulting in burns, ignition or welding of parts. Take proper precautions before remotely
programming the output circuits.
Printing History
The edition and current revision of this guide are indicated below. Reprints of this guide containing minor corrections and
updates may have the same printing date. Revised editions are identified by a new printing date. A revised edition
incorporates all new or corrected material since the previous printing. Changes to the guide occurring between revisions are
covered by change sheets shipped with the guide.
Prerequisites for Using this Guide8
VXIplug&play Power Product Instrument Drivers8
Downloading and Installing the Driver8
Accessing Online Help8
REMOTE PROGRAMMING9
GPIB Capabilities Of The Power Supply9
Introduction To SCPI9
Conventions9
SCPI Messages10
Types of SCPI Commands10
Structure of a SCPI Message10
Parts of a SCPI Message11
Traversing the Command Tree12
Including Common Commands14
SCPI Queries14
Value Coupling14
SCPI Data Formats14
Examples15
Controlling Output16
Saving and Recalling States17
Writing to the Display17
Programming Status17
Programming the Digital I/O Port18
System Considerations18
The GPIB Address18
DOS Drivers20
Agilent BASIC Controllers20
Sample Program Code20
LANGUAGE DICTIONARY25
Introduction25
Parameters25
Related Commands25
Order of Presentation25
Common Commands25
Subsystem Commands25
Power Supply Status Structure51
Operation Status Group51
Register Functions51
Register Commands51
Questionable Status Group53
Register Functions53
Register Commands53
Standard Event Status Group53
Register Functions53
Register Commands53
Status Byte Register54
The RQS Bit54
The MSS Bit54
Determining the Cause of a Service Interrupt54
Service Request Enable Register54
Output Queue54
Initial Conditions At Power On54
Status Registers54
The PON (Power-On) Bit55
Examples55
Servicing an Operation Status Mode Event55
Adding More Operation Events56
Servicing Questionable Status Events56
Monitoring Both Phases of a Status Transition56
SCPI Command Completion57
DFI (Discrete Fault Indicator)57
RI (Remote Inhibit)57
ERROR MESSAGES59
Power Supply Hardware Error Messages59
Calibration Error Messages59
System Error Messages59
This guide provides remote programming information for the following series of GPIB programmable power supplies:
•AGILENT Series 664xA, 665xA, 667xA, 668xA, and 669xA
You will find the following information in the rest of this guide:Chapter 2Introduction to SCPI messages structure, syntax, and data formats. Examples of SCPI programs.Chapter 3Dictionary of SCPI commands. Table of programming parameters.Chapter 4Description of the status registers.Chapter 5Error messages.Appendix ASCPI conformance information.Appendix BUse of the alternate Compatibility programming language.
Documentation Summary
User’s Guide
The Operating Guide, shipped with the power supply, has information helpful to programming the power supply and
explains the SCPI commands used for remote calibration. Sample calibration and verification programs are included.
1
External Documents
SCPI References
The following documents will assist you with programming in SCPI:
• Standard Commands for Programmable Instruments Volume 1, Syntax and Style
• Standard Commands for Programmable Instruments Volume 2, Command References
• Standard Commands for Programmable Instruments Volume 3, Data Interchange Format
• Standard Commands for Programmable Instruments Volume 4, Instrument Classes
To obtain a copy of the above documents, contact: Fred Bode, Executive Director, SCPI Consortium, 8380 Hercules Drive,
Suite P3, Ls Mesa, CA 91942, USA
GPIB References
The most important GPIB documents are your controller programming manuals - Agilent BASIC, GPIB Command Library
for MS DOS, etc. Refer to these for all non-SCPI commands (for example: Local Lockout).
The following are two formal documents concerning the GPIB interface:
aANSI/IEEE Std. 488.1-1987 IEEE Standard Digital Interface for Programmable Instrumentation. Defines the
technical details of the GPIB interface. While much of the information is beyond the need of most programmers, it can serve
to clarify terms used in this guide and in related documents.
aANSI/IEEE Std. 488.2-1987 IEEE Standard Codes, Formats, Protocols, and Common Commands. Recommended
as a reference only if you intend to do fairly sophisticated programming. Helpful for finding precise definitions of certain
types of SCPI message formats, data types, or common commands.
The previous two documents are available from the IEEE (Institute of Electrical and Electronics Engineers), 345 East 47th
Street, New York, NY 10017, USA. The WEB address is www.ieee.org.
Introduction 7
Prerequisites for Using this Guide
This organization of this guide assumes that you know or can learn the following information:
1. How to program in your controller language (Agilent BASIC, QUICKBASIC, C, etc.).
2. The basics of the GPIB (IEEE 488).
3. How to program I/O statements for an IEEE 488 bus instrument. From a programming aspect, the power supply is
simply a bus instrument.
4. How to format ASCII statements within you I/O programming statements. SCPI commands are nothing more than
ASCII data strings incorporated within those I/O statements.
5. The basic operating principles of the power supply as explained in “Chapter 5 – Front Panel Operation” of the
Operating Guide.
6. How to set the GPIB address of the power supply. This cannot be done remotely, but only from the supply’s front
panel (see System Considerations in “Chapter 2 – Remote Programming”).
VXIplug&play Power Product Instrument Drivers
VXIplug&play instrument drivers for Microsoft Windows 95 and Windows NT are now available on the Web at
http://www.agilent.com/find/drivers. These instrument drivers provide a high-level programming interface to your Agilent
Technologies instrument. VXIplug&play instrument drivers are an alternative to programming your instrument with SCPI
command strings. Because the instrument driver's function calls work together on top of the VISA I/O library, a single
instrument driver can be used with multiple application environments.
The VXIplug&play Power Products instrument driver
complies with the following:
aMicrosoft Windows 95
aMicrosoft Windows NT
aHP VISA revision F.01.02
aNational Instruments VISA 1.1
Downloading and Installing the Driver
NOTE: Before installing the VXIplug&play instrument driver, make sure that you have one of the supported applications
installed and running on your computer.
1.Access Agilent Technologies' Web site at http://www.agilent.com/find/drivers.
2. Select the instrument for which you need the driver.
3. Click on the driver, either Windows 95 or Windows NT, and download the executable file to your pc.
4.Locate the file that you downloaded from the Web. From the Start menu select Run <path>:\agxxxx.exe - where
<path> is the directory path where the file is located, and agxxxx is the instrument driver that you downloaded .
5.Follow the directions on the screen to install the software. The default installation selections will work in most
cases. The readme.txt file contains product updates or corrections that are not documented in the on-line help. If
you decide to install this file, use any text editor to open and read it.
6.To use the VXIplug&play instrument driver, follow the directions in the VXIplug&play online help under
“Introduction to Programming”.
Accessing Online Help
A comprehensive online programming reference is provided with the driver. It describes how to get started using the
instrument driver with Agilent VEE, LabVIEW, and LabWindows. It includes complete descriptions of all function calls
as well as example programs in C/C++ and Visual BASIC.
aTo access the online help when you have chosen the default Vxipnp start folder, click on the Start button and select
Programs | Vxipnp | Agxxxx Help (32-bit).
- where agxxxx is the instrument driver.
8 Introduction
2
Remote Programming
GPIB Capabilities Of The Power Supply
All power supply functions except for setting the GPIB address are programmable over the IEEE 488 bus (also known as
the General Purpose Interface Bus or "GPIB"). The IEEE 488.1 capabilities of the power supply are listed in the
Supplemental Characteristics of the Operating Guide. The power supply operates from a GPIB address that is set from the
front panel (see System Considerations at the end of this chapter).
Introduction To SCPI
lmportantLearn the basics of power supply operation (see "Chapter 5 - Front Panel Operation" in the power supply
Operating Guide) before using SCPI.
SCPI (Standard Commands for Programmable Instruments) is a programming language for controlling instrument functions
over the GPIB (IEEE 488) instrument bus. SCPI is intended to function with standard GPIB hardware and conforms to the
IEEE Standard Digital Interface for Programmable Instrumentation. SCPI is layered on top of the hardware portion of
IEEE 488.2. The same SCPI commands and parameters control the same functions in different classes of instruments. For
example, you would use the same DISPlay command to control the power supply display state and the display state of a
SCPI-compatible multimeter.
NoteHPSL and TMSL (Test and Measurement System Language) were earlier versions of SCPI. If you have
programmed in either, then you probably can go directly to "Chapter 3 - Language Dictionary".
Conventions
The following conventions are used throughout this chapter:
Angle brackets< >Items within angle brackets are parameter abbreviations. For example,
<NR1> indicates a specific form of numerical data.
Vertical bar|Vertical bars separate one of two or more alternative parameters. For
example, 0|OFF indicates that you may enter either "0" or "OFF" for the
required parameter.
Square
Brackets
Braces{ }Braces indicate parameters that may be repeated zero or more times. It is
Boldface font
[ ]Items within square brackets are optional. The representation
[SOURce]:CURRent means that SOURce may be omitted.
used especially for showing arrays. The notation<A>{<,B>} shows that
"A" is a required parameter, while "B" may be omitted or may be entered
one or more times.
Boldface font is used to emphasize syntax in command definitions.
TRIGger:DELay <NRf> shows a command syntax.
Computer fontComputer font is used to show program text within normal text.
TRIGger:DELay .5 represents program text.
Remote Programming 9
SCPI Messages
There are two types of SCPI messages, program and response.
•A program message consists of one or more properly formatted SCPI commands sent from the controller to
the power supply. The message, which may be sent at any time, requests the power supply to perform some action.
•A response message consists of data in a specific SCPI format sent from the power supply to the controller.
The power supply sends the message only when commanded by a special program message called a "query."
Types of SCPI Commands
SCPI has two types of commands, common and subsystem.
Common CommandsCommon commands (see Figure 3-1) generally are not related to specific operation but to controlling overall power supply
functions, such as reset, status, and synchronization. All common commands consist of a three-letter nmemonic preceded
by an asterisk:
*RST *IDN? *SRE 8
Subsystem CommandsSubsystem commands (see Figure 3-2) perform specific power supply functions. They are organized into an inverted tree
structure with the "root" at the top. Some are single commands while others are grouped under other subsystems.
Structure of a SCPI Message
SCPI messages consist of one or more message units ending in a message terminator. The terminator is not part of the
syntax, but implicit in the way your programming language indicates the end of a line (such as a newline or end-of-line
character).
The Message UnitThe simplest SCPI command is a single message unit consisting of a command header (or keyword) followed by a message
terminator.
ABORVOLT?
The message unit may include a parameter after the header. The parameter usually is numeric, but it can be a string:
VOLT 20VOLT MAX
Combining Message Units
The following command message (see Figure 2-1) is briefly described here, with more details in subsequent paragraphs.
VOLT:LEV 4.5;PROT 4.8;:CURR?<NL>
10 Remote Programming
The basic parts of the message in Figure 2-1 are:
Message ComponentExampleHeadersVOLT LEV PROT CURRHeader SeparatorThe colon in VOLT:LEVData4.5 4.8Data SeparatorThe space in VOLT 4. 5 and PROT 4. 8Message UnitsVOLT:LEV 4.5 PROT 4.8 CURR?Message Unit SeparatorRoot SpecifierThe colon in PROT 4. 8; : CURR?Query IndicatorThe question mark in CURR?Message TerminatorThe <NL> (newline) indicator. Terminators are not part of the SCPI syntax.
Figure 2-1. Command Message Structure
The semicolons in VOLT: LEV 4. 5; andPROT 4. 8;
Parts of a SCPI Message
HeadersHeaders (which are sometimes known as "keywords") are instructions recognized by the power supply interface. Headers
may be either in the long form or the short form.
Long Form The header is completely spelled out, such as VOLTAGE STATUS DELAY.Short Form The header has only the first three or four letters, such as VOLT STAT DEL.
Short form headers are constructed according to the following rules:
• If the header consists of four or fewer letters, use all the letters. (DFI DATA)
• If the header consists of five or more letters and the fourth letter is not a vowel (a,e,i,o,u), use the first four
letters. (VOLTageSTATus)
•If the header consists of five or more letters and the fourth letter is a vowel (a,e,i,o,u), use the first three letters.(DELayCLEar)
You must follow the above rules when entering headers. Creating an arbitrary form, such as QUEST for QUESTIONABLE,
will result in an error. The SCPI interface is not sensitive to case. It will recognize any case mixture, such as VOLTAGE,
Voltage, Volt, volt.
Note Shortform headers result in faster program execution.
Remote Programming 11
Header Convention. In this manual, headers are emphasized with boldface type. The proper short form is shown in
upper-case letters, such as DELay.
Header Separator. If a command has more than one header, you must separate them with a colon. (VOLT:PROT
OUTPut:PROTection:CLEar)
Optional Headers. The use of some headers is optional. Optional headers are shown in brackets, such as
OUTPut[:STATe] ON. However, if you combine two or more message units into a compound message, you may need to
enter the optional header. This is explained under "Traversing the Command Tree."
Query IndicatorFollowing a header with a question mark turns it into a query (VOLT? VOLT:PROT?). If a query contains a parameter,
place the query indicator at the end of the last header (VOLT:PROT? MAX).
Message Unit SeparatorWhen two or more message units are combined into a compound message, separate the units with a semicolon
(STATus:OPERation?;QUEStionable?).
ImportantYou can combine message units only at the current path of the command tree (see "Traversing the
Command Tree").
Root SpecifierWhen it precedes the first header of a message unit, the colon becomes a "root specifier". This indicates that the command
path is at the root or top node of the command tree. Note the difference between root specifiers and header separators in the
following examples:
OUTP:PROT:DEL .1All colons are header separatorsOUTP:PROT:DEL .1 The first colon is a root specifierOUTP:PROT:DEL .l;:VOLT 12.5 The third colon is a root specifier
Message TerminatorA terminator informs SCPI that it has reached the end of a message. Three permitted messages terminators are:
• Newline (<NL>), which is ASCII decimal 10 or hex 0A.
• End or identify (<END>).
• Both of the above (<NL><END>).
In the examples of this manual, there is an assumed message terminator at the end of each message. If the terminator needs
to be shown, it is indicated as <NL> regardless of the actual terminator character.
Traversing the Command Tree
Figure 2-2 shows a portion of the subsystem command tree (you can see the complete tree in Figure 3-2). Note the location
of the ROOT node at the top of the tree. The SCPI interface is at this location when:
• The power supply is powered on.
• A device clear (DCL) is sent to the power supply.
• The interface encounters a message terminator.
• The interface encounters a root specifier.
12 Remote Programming
Active Header PathIn order to properly traverse the command tree, you must understand the concept of the active header path. When the power
supply is turned on (or under any of the other conditions listed above), the active path is at the root. That means the
interface is ready to accept any command at the root level, such as TRIGger or STATus in Figure 2-2. Note that you do
not have to precede either command with a colon; there is an implied colon in front of every root-level command.
If you enter STATUS, the active header path moves one colon to the right. The interface is now ready to accept :
OPERATION, :PRESET, or QUESTIONABLEas the next header. Note that you must include the colon, because it is required
between headers.
If you next enter :OPERATION, the active path again moves one colon to the right. The interface is now ready to accept
:EVENT?, CONDITON?, ENABLE, NTRANSITION, or PTRANSITION as the next header.
If you now enter :ENABLE, you have reached the end of the command string. The active header path remains at :ENABLE.
If you wished, you could have entered :ENABLE 18;PTRANSITION 18 and it would be accepted. The entire message would
be STATUS:OPERATION:ENABLE 18;PTRANSITION 18. The message terminator after PTRANSITION 18 returns the path to the
root.
The Effect of Optional HeadersIf a command includes optional headers, the interface assumes they are there. For example, if you enter STATUS:
OPERATION?, the interface recognizes it as STATUS: OPERATION: EVENT? (see Figure 2-2). This returns the active path to
the root (:STATUS). But if you enter STATUS: OPERATION: EVENT?, then the active path remains at :EVENT. This allows
you to send STATUS: OPERATION: EVENT?; CONDITION? in one message. If you tried to send
STATUS:OPERATION?;CONDITION? the command path would send STATUS:OPERATION:EVENT? and then return to
:STATUS instead of to :CONDITION.
The optional header SOURCEprecedes the current, digital, and voltage subsystems (see Figure 3-2). This effectively makes
:CURRENT, :DIGITAL, and :VOLTAGEroot-level commands.
Moving Among SubsystemsIn order to combine commands from different subsystems, you need to be able to restore the active path to the root. You do
this with the root specifier (:). For example, you could clear the output protection and check the status of the Operation
Condition register as follows (see Figure 3-2):
NoteThe SCPI parser traverses the command tree as described in Appendix A of the IEEE 488.2 standard. The
"Enhanced Tree Walking Implementation" given in that appendix is not implemented in the power supply.
The following message shows how to combine commands from different subsystems as well as within the same subsystem
(see Figure 3-2):
VOLTAGE:LEVEL 7;PROTECTION 8;:CURRENT:LEVEL 50;PROTECTION ON
Note the use of the optional header LEVEL to maintain the correct path within the voltage and current subsystems and the
use of the root specifier to move between subsytems.
Including Common Commands
You can combine common commands with system commands in the same message. Treat the common command as a
message unit by separating it with the message unit separator. Common commands do not affect the active header path;
you may insert them anywhere in the message.
VOLT:TRIG 7.5;INIT;*TRGOUTP OFF;*RCL 2;OUTP ON
SCPI Queries
Observe the following precautions with queries:
• Remember to set up the proper number of variables for the returned data.
• Set the program to read back all the results of a query before sending another command to the power supply.
Otherwise, a Query Interrupted error will occur and the unreturned data will be lost.
Value Coupling
Value coupling results when a command directed to send one parameter also changes the value of a second parameter.
There is no direct coupling among any power supply SCPI commands. However, be aware that until they are programmed,
uninitialized trigger levels will assume their corresponding immediate levels. For example, if a power supply is powered up
and VOLT:LEV is programmed to 6, then VOLT:LEV:TRIG will also be 6 until you program it to another value. Once
you program VOLT:LEV:TRIG to another value, it will remain at that value regardless of how you subsequently
reprogram VOLT:LEVEL.
SCPI Data Formats
All data programmed to or returned from the power supply is ASCII. The data may be numerical or character string.
Numerical DataTable 2-1 and Table 2-2 summarize the numerical formats.
Table 2-1. Numerical Data Formats
SymbolData Form
Talking Formats
<NR1>Digits with an implied decimal point assumed at the right of the least-significant
digit. Examples: 273 0273
<NR2><NR3>
Digits with an explicit decimal point. Example: 273. .0273Digits with an explicit decimal point and an exponent. Example: 2.73E+2 273.0E-2
Boolean DataEither form {1|0} or {ON|OFF} may be sent with commands. Queries always return 1 or 0.
OUTPut OFFCURRent:PROTection 1
Character DataFor query statements, character strings may be returned in either of the forms shown in Table 2-3, depending on the length
of the returned string.
<CRD><AARD>
Note:
Character Response Data. Permits the return of character strings.Arbitrary ASCII Response Data. Permits the return of undelimited 7-bit ASCII. This data type has
an implied message terminator.
The IEEE 488.2 format for a string parameter requires that the string be enclosed within either single
(' ') or double (" ") quotes. Be certain that your program statements comply with this requirement.
Extended format that includes <NR1>, <NR2> and <NR3>. Examples: 273 273.
2.73E2
Expanded decimal format that includes <NRf>, MIN and MAX. Examples: 273
273. 2.73E2 MAX. MIN and MAX are the minimum and maximum limit values
that are implicit in the range specification for the parameter.
Table 2-2. Suffixes and Multipliers
Common Multipliers
Table 2-3. Character Data Formats
Listening Formats
Examples
The examples given here are generic, without regard to the programming language or type of GPIB interface. Because
SCPI commands are sent as ASCII output strings within the programming language statements, the SCPI syntax is
independent of both programming language and interface.
NoteThe examples are followed by sample program code written for three popular types of BASIC-
controlled GPIB interfaces.
Remote Programming 15
Controlling the Output
ImportantThe power supply responds simultaneously to both digital and analog programming inputs. If it
is receiving an input over the GPIB and a corresponding input from the front panel (and/or from
the analog programming port), the power supply output will be the algebraic sum of the inputs.
Programming Voltage and CurrentThe following statements program both voltage and current and return the actual output from the sense terminals:
OUTP OFFDisable the output.VOLT 4.5;CURR 255Program the voltage and current.VOLT?;CURR?Read back the programmed levels.OUTP ONEnable the output.MEAS:VOLT?;MEAS:CURR?Read back the outputs from the sense terminals.
Programming Protection CircuitsThis example programs the voltage and current, programs an overvoltage protection value, and turns on the overcurrent
protection. It then reads back all the programmed values.
VOLT:LEV 4.5;PROT 4.75Program the voltage and overvoltage protection.CURR:LEV 255;PROT:STAT ONProgram the current and overcurrent protection.VOLT:LEV?;PROT?;:CURR:LEV?;PROT:STAT?Read back the programmed values.
Note the required use of the optional LEVel header in the above example (see "The Effect of Optional Headers", given
previously).
Changing Outputs by TriggerIf you do not program pending triggered levels, they default to the programmed (immediate) output levels. The following
statements shows some basic trigger commands.
OUTP OFFDisable the output.VOLT:LEV:IMM 2.2;TRIG 2.5Program the (immediate) voltage level to 2.2V and the pending
triggered level to 2.5 V.
CURR:LEV:IMM I5O;TRIG 250 Program the (immediate) current level to 150 A and the pending
triggered level to 250 A.
VOLT:LEV:IMM?;TRIG?;:CURR:LEV:IMM?;TRIG?Check all the programmed values.OUTP ONEnable the output.MEAS:VOLT?;CURR?Read back the immediate levels from the sense terminals.INTIT;TRIGArm the trigger circuit and send a single trigger.INIT;*TRGSame as above, except using a common command.MEAS:VOLT?;CURR?Read back the triggered levels from the sense terminals.
If you need to send two or more triggers, program the trigger circuit for continuous arming.
OUTP OFFDisable the output.VOLT:LEV:IMM 5.O;TRIG 2.5Program the (immediate) voltage level to 5 V and the pending
triggered level to 2.5 V.
INTIT:CONT ONProgram the trigger circuit for continuous arming.OUTP ONEnable the output to 5 V.TRIGTrigger the output voltage to 2.5 V.VOLT:TRIG 5;:TRIGSet the pending trigger level to 5 V and trigger the output voltage
back to 5 V.
INTIT:CONT OFF Remove the continuous trigger arming.
16 Remote Programming
Saving and Recalling States
You can remotely save and recall operating states. See *SAV and *RCL in "Chapter 3 - Language Dictionary" for the
parameters that are saved and recalled.
NoteWhen you turn the power supply on, it automatically retrieves the state stored in location 0.
When a power supply is delivered, this location contains the factory defaults (see *RST in
"Chapter 3 - Language Dictionary").
OUTP OFF;VOLT:LEV 6.5;PROT 6.8Program a desired operating state.CURR:LEV 335;PROT:STAT ON*SAV 2Save this state to location 2.*RCL 2(Later) recall this same state.
Writing to the Display
You can include messages to the front panel LCD in your programs. The description of DISP:TEXT in "Chapter 3 -
Language Dictionary" shows the number and types of permitted display characters. In order to write to the display, you
must first change it to text mode as shown in the following example:
DIS:MODE TEXTSwitch display to text mode.RECALLED 2Write “Recalled 2” to the display.DIS:MODE NORMReturn display to its normal mode.
Programming Status
You can use status programming to make your program react to events within the power supply. "Chapter 4 - Status
Reporting" explains the functions and bit configurations of all status registers. Refer to Figure 4-1 in that chapter while
examining the examples given here.
Detecting Events via SROUsually you will want the power supply to generate interrupts (assert SRQ) upon particular events. For this you must
selectively enable the appropriate status register bits. The following examples allow the power supply to assert SRQ under
selected conditions.
1. STAT:OPER:ENAB 1280;PTR 1280;*SRE 128 Assert SRQ when the supply switches between CV and CC
modes.
2. STAT:OPER:ENAB 1;PTR 1;NTR 1;*SRE 128Assert SRQ when the supply enters or leaves calibration mode.
3. STAT:QUES 3;PTR 3;*SRE 128Assert SRQ when the supply goes into overvoltage or
STAT:OPER:ENAB?;EVENT?;:STAT:QUES:ENAB?;EVEN?;:*ESE?;*ESR?Read which events are active and which events are enabled in
Assert SRQ under any event occurring in 1. or 3., above.
Enable only the CV and CC events and read their status.Enable all conditions of the Operation Status register and read
any events.
the Operation, Questionable, and Standard Event status
registers.
Remote Programming 17
Note The last query string can be handled without difficulty. However, should you request too many
queries, the system may return a "Query DEADLOCKED” error (-430). In that case, break the
long string into smaller parts.
Programming the Digital I/O Port
Digital control ports 1 and 2 are TTL outputs that can be programmed either high or low. Control port 3 can be
programmed to be either a TTL input or a TTL output. Send a decimal parameter that translates into the desired straight
binary code for these ports. (See DIG:DATA[:VAL] in "Chapter 3 - Language Dictionary" for the port bit configurations.)
DIG:DATA 3Set ports 1 and 2 high and make 3 another output port.DIG:DATA 7Set ports 1 and 2 high and make 3 an input port.DIG:DATA?Read back the present port configuration.
System Considerations
The remainder of this chapter addresses some system issues concerning programming. These are power supply addressing
and the use of the following types of GPIB system interfaces:
1.HP Vectra PC controller with Agilent 82335A GPIB Interface Command Library.
2.IBM PC controller with National Instruments GPIB-PCII Interface/Handler.
3.Agilent controller with Agilent BASIC Language System.
The GPIB Address
The power supply address cannot be set remotely; it must be set from the front panel. Once the address is set, you can
assign it inside programs.
Setting the GPIB AddressFigure 4-6 in the power supply Operating Guide shows the ways the power supply can be connected to the GPIB bus. You
can set up the GPIB address in one of three ways:
1.As a stand-alone supply (the only supply at the address). It has a primary address in the range of 0 to 30. For
example:
5 or 7
2.As the direct supply in a serial link. It is the only supply connected directly to the GPIB bus. The primary address is
unique and can be from 0 to 30. It is entered as an integer followed by a decimal separator. The secondary address
always is 0, which may be added after the primary address. If the secondary address is omitted, it is assumed to be 0.
For example:
5.0 or 7.
3.As a linked supply in serial link. It gets its primary address from the direct supply. It has a unique secondary address
that can be from 1 to 15. It is entered as an integer preceded by a decimal separator. For example:
.1 or .12
When you enter a secondary address, leading zeros between the decimal separator and the first digit are ignored. For
example, .1, .01, and .001 are accepted as secondary address 1 and displayed as 0.01. Zeros following a digit are not
ignored. Thus, .10 and .010 are both accepted as secondary address 10 and displayed as 0. 10.
Changing the Power Supply GPIB AddressUse the
address as the default. The general procedure for setting an address is:
key and numerical keypad for entering addresses. The power supply is shipped with a 5 stand-alone
18 Remote Programming
ActionDisplay ShowsPress Press new address keysNew address replaces numbers on the display
Press
If you try to enter a forbidden number, ADDR ERROR is displayed.The following examples show how to set addresses:
To set stand-along primary address 6, press
To set direct supply primary address 6, press
To set linked secondary address 1, press
To set linked secondary address 12, press
Display returns to meter mode
Current address
NoteThe power supply display will reset (recall the state in location 0) whenever you change between
the following types of GPIB addresses:
•A stand-alone primary address and a direct primary address.
•A direct primary address and a secondary address.
Assigning the GPIB Address In Programs
The following examples assume that the GPIB select code is 7, the the power supply is 6, and that the power supply address
will be assigned to the variable @PS.
1000!Stand-alone address. The power supply will respond if it is set to 6
1010PS=706!Statement for Agilent 82335A Interface
1010ASSIGN @PS TO 706! Statement for Agilent BASIC Interface
1020!Direct address. The power supply will respond if it is set to 6. or 6.0
1030PS-70600! Statement for Agilent 82335A Interface
1030ASSIGN @PS TO 70600! Statement for Agilent BASIC Interface
1040!Linked address 1. The power supply will respond if it is set to address .1 and is serially connected to a
supply at direct address 6.0
1050PS=706.01!Agilent 82335A Interface
1090ASSIGN @PS TO 706.01!Agilent BASIC Interface
For systems using the National Instruments DOS driver, the address is specified in the software configuration program
(IBCONFIG.EXE) and assigned a symbolic name. The address then is referenced only by this name within the application
program (see the National Instruments GP-IB documentation).
Remote Programming 19
DOS Drivers
Types of Drivers
The Agilent 82335A and National Instruments GP-IB are two popular DOS drivers. Each is briefly described here. See the
software documentation supplied with the driver for more details.
Agilent 82335A Driver. For GW-BASIC programming, the GPIB library is implemented as a series of subroutine calls.
To access these subroutines, your application program must include the header file SETUP.BAS, which is part of the DOS
driver software.
SETUP.BAS starts at program line 5 and can run up to line 999. Your application programs must begin at line 1000.
SETUP.BAS has built-in error checking routines that provide a method to check for GPIB errors during program execution.
You can use the error-trapping code in these routines or write your own code using the same variables as used by
SETUP.BAS.
National Instruments GP-IB Driver. Your program must include the National Instruments header file DECL.BAS.
This contains the initialization code for the interface. Prior to running any applications programs, you must set up the
interface with the configuration program (IBCONF.EXE).
Your application program will not include the power supply symbolic name and GPIB address. These must be specified
during configuration (when you run IBCONF.EXE). Note that the primary address range is from 0 to 30 but any secondary
address must be specified in the address range of 96 to 126. The power supply expects a message termination on EOI or
line feed, so set EOI w/last byte of Write. It is also recommended that you set Disable Auto Serial Polling.
All function calls return the status word IBSTA%, which contains a bit (ERR) that is set if the call results in an error. When
ERR is set, an appropriate code is placed in variable IBERR%. Be sure to check IBSTA% after every function call. If it is
not equal to zero, branch to an error handler that reads IBERR% to extract the specific error.
Error Handling
If there is no error-handling code in your program, undetected errors can cause unpredictable results. This includes
"hanging up" the controller and forcing you to reset the system. Both of the above DOS drivers have routines for detecting
program execution errors.
ImportantUse error detection after every call to a subroutine.
Agilent BASIC Controllers
The Agilent BASIC Programming Language provides access to GPIB functions at the operating system level. This makes it
unnecessary to have the header files required in front of DOS applications programs. Also, you do not have to be concerned
about controller "hangups" as long as your program includes a timeout statement. Because the power supply can be
programmed to generate SRQ on errors, your program can use an SRQ service routine for decoding detected errors. The
detectable errors are listed in Table 5-1 of "Chapter 5 - Error Messages".
Sample Program Code
The following programs are intended only to show how some of the same power supply functions can be programmed to
each of the three previously mentioned GPIB interfaces. The first two are for the DOS interfaces and the third for the
Agilent BASIC interface.
20 Remote Programming
Programming Some Power Supply Functions
SAMPLE FOR POWER SUPPLY AT STAND-ALONE ADDRESS 6. SEQUENCE SETS UP CV MODE OPERATION,
FORCES SUPPLY TO SWITCH TO CC MODE, AND DETECTS AND REPORTS MODE CHANGE.
**************************************************************************
Controller Using Agilent 82335A Interface
**************************************************************************
5‘ < --------------- Merge SETUP.BAS here -------------------- >
1000MAX.ELEMENTS=2 : ACTUAL.ELEMENTS=O :MAX.LENGTH=80 :ACT.LENGTH=O
1005DIM OUTPUTS(2) :CDDES$=SPACE$(40)
1010ISC=7 :PS=706
1015‘
1020'Set up the Power Supply Interface for DOS driver
1025CALL IORESET (ISC)'Reset the interface
1030IF PCIB.ERR < > NOERR THEN ERROR PCIB.BASERR
1035TIMEOUT=3
1040CALL IOTIMEOUT (ISC, TIMEOUT)'Set timeout to 3 seconds
1045IF PCIB.ERR < > NOERR THEN ERROR PCIB.BASERR
1050CALL IOCLEAR (ISC)'Clear the interface
1055IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1060CALL IOREMOTE (ISC)'Set Power Supply to remote mode
1065IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1070‘
1075'Program power supply to CV mode with following voltage and current
1080CODES$ = "VOLTAGE 7.8;CURRENT 480":GOSUB 2000
1085‘
1090'Query power supply outputs & print to screen
1095CODES$ = "MEASURE:VOLTAGE?;CURRENT?":GOSUB 2000 :GOSUB 3000
1100VOUT = OUTPUTS(I)
1105IOUT = OUTPUTS(2)
1110PRINT "The output levels are "VOUT" Volts and "IOUT" Amps"
1115‘
1120'Program triggered current level to value insufficient to maintain
1125'supply within its CV operating characteristic
1130CODES$ = "CURR:TRIG 50":GOSUB 2000
1135‘
1140'Set operation status mask to detect mode change from CV to CC
1145CODES$ = "STAT:OPER:ENAB 1024;PTR 1024":GOSUB 2000
1150‘
1155'Enable Status Byte OPER summary bit
1160CODES$ = "*SRE 128":GOSUB 2000
1165‘
1170'Arm trigger circuit and send trigger to power supply
1175CODES$ = "INITIATE;TRIGGER" :GOSUB 2000
1180‘
1185'Wait for supply to respond to trigger
1190FOR I= 1 to 100 :NEXT I
1195‘
1200'Poll for interrupt caused by change to CC mode and print to screen
1205CALL IOSPOLL (PS,RESPONSE)
1210IF (RESPONSE AND 128)< >128 THEN GOTO 1240'No OPER event to report
1215CODES$ = "STATUS:OPER:EVEN?" :GOSUB 2000 'Query status oper register
Remote Programming 21
Loading...
+ 49 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.