1)This manual is valid for the following Model and associated serial numbers:
FIRMWARE VERSIONNOTE
10.07 and higher
2)A Change Page may be included at the end of the manual. All applicable changes and
revision number changes are documented with reference to the equipment serial numbers. Before using this Instruction Manual, check your equipment serial number to identify
your model. If in doubt, contact your nearest Kepco Representative, or the Kepco Documentation Office in New York, (718) 461-7000, requesting the correct revision for your
particular model and serial number.
3)The contents of this manual are protected by copyright. Reproduction of any part can be
made only with the specific written permission of Kepco, Inc.
KEPCO, INC. ! 131-38 SANFORD AVENUE ! FLUSHING, NY. 11355 U.S.A. ! TEL (718) 461-7000 ! FAX (718) 767-1102
email: hq@kepcopower.com ! World Wide Web: http://www.kepcopower.com
KEPCO®
THE POWER SUPPLIER™
Page 2
Page 3
TABLE OF CONTENTS
SECTIONPAGE
SECTION 1 - INTRODUCTION
1.1 General Description .................................................................................................................................... 1-1
1.1.2 Communication ....................................................................................................................................... 1-2
1.2.2 Output Control ......................................................................................................................................... 1-3
1.2.5 Save/Recall (Storage of User-Programmed Active Settings).................................................................. 1-3
1.2.6 LIST (User-Programmed Sequences)..................................................................................................... 1-3
1.2.7 Status ...................................................................................................................................................... 1-4
1.2.7.1 Status Reporting Structure................................................................................................................. 1-4
1.2.7.2 Status Byte Register Set .................................................................................................................... 1-6
1.2.7.3 Standard EvenT Status Register Set ................................................................................................. 1-6
1.2.7.4 Operation Status Register Set ........................................................................................................... 1-7
1.2.7.5 QUEStionable Status Register Set .................................................................................................... 1-7
2.2 Front Panel (local) Control.......................................................................................................................... 2-1
2.3 Digital Control via LAN [E-Series Models Only] .......................................................................................... 2-2
2.4 Digital Control via GPIB.............................................................................................................................. 2-3
2.5 Digital Control via RS 232 [Standard Models only]..................................................................................... 2-3
3.1.2 Range Checking and Coercion ............................................................................................................... 3-1
3.1.3 Multithreading Support ............................................................................................................................ 3-1
3.1.6 Rights ...................................................................................................................................................... 3-2
3.3 Examples Using C ...................................................................................................................................... 3-4
3.3.1 Setting the output to a value and Making a Measurement...................................................................... 3-4
3.3.2 Using a list to Perform a Series of Operations ........................................................................................ 3-8
3.5 Examples Using LabView ........................................................................................................................... 3-17
3.5.1 Setting the output to a value.................................................................................................................... 3-18
3.5.2 Getting a voltage and current reading from the power supply................................................................. 3-18
3.5.3 Changing the limit model......................................................................................................................... 3-19
SECTION 4 - LABVIEW G DRIVER
4.2 LabView G Instrument Driver...................................................................................................................... 4-1
4.3 LabView G Instrument Driver Functions..................................................................................................... 4-1
4.4 Using the Driver Functions ......................................................................................................................... 4-3
4.5 Example of Setting the Output................................................................................................................... 4-6
4.5.1 Initialization Function .............................................................................................................................. 4-7
4.5.2 Set the OUtput ON or OFF ..................................................................................................................... 4-9
4.5.3 Get Measurement and Status................................................................................................................. 4-9
4.5.4 Close Connection ................................................................................................................................... 4-9
4.6 Interactive demonstration program ............................................................................................................ 4-10
4.6.4 Function Generator................................................................................................................................. 4-15
5.4 Using the VXI plug&play driver .................................................................................................................. 5-3
5.4.1 Example 1: Setting Voltage and Current ................................................................................................ 5-3
5.4.2 Example 2: Using the power supply to create a voltage ramp................................................................ 5-5
5.4.3 Example 3: Using the power supply to Take Measurements.................................................................. 5-7
5.5 Demonstration Program Using the VXI plug&play Driver........................................................................... 5-9
5.5.2 Main Panel.............................................................................................................................................. 5-10
5.5.3 Power Supply Events.............................................................................................................................. 5-14
SECTION 6 - PROGRAMMING THE KLR USING SCPI COMMANDS
6.4.4 LIST Subsystem ..................................................................................................................................... 6-2
6.4.7 STATus Subsystem................................................................................................................................ 6-2
6.4.9 SYSTem subsystem ............................................................................................................................... 6-2
6.4.10 [SOURce:]VOLTage and [SOURce:]CURRent Subsystems .................................................................. 6-2
6.5.4 Data ........................................................................................................................................................ 6-5
6.5.5 Data Separator ....................................................................................................................................... 6-5
6.5.6 Message Unit Separator......................................................................................................................... 6-5
6.6 Understanding The Command Structure ................................................................................................... 6-7
6.7 Program Message Syntax Summary ......................................................................................................... 6-7
6.7.1 Exceptions to the Rules.......................................................................................................................... 6-8
9.2 Using Port 80 (Web Interface) .................................................................................................................... 9-1
9.3 Using Port 5024 (Telnet)............................................................................................................................. 9-1
9.4 Using Port 5025 (SCPI-RAW)..................................................................................................................... 9-2
9.5 Using Port 1024 (VXI-11)............................................................................................................................ 9-2
9.6 Using Port 5044 ( *TRG command)............................................................................................................ 9-2
9.7 SUNRPC Port 111 ...................................................................................................................................... 9-2
APPENDIX A - IEEE 488.2 COMMAND/QUERY DEFINITIONS
A.2 *CLS — Clear Status Command ............................................................................................................... A-1
A.3 *ESE — Standard Event Status Enable Command................................................................................... A-1
A.4 *ESE? — Standard Event Status Enable Query........................................................................................ A-2
A.5 *ESR? — Event Status Register Query..................................................................................................... A-2
1-1 Status Reporting Structure......................................................................................................................... 1-5
B-1 Programming the Output............................................................................................................................ B-3
B-2 Using LIST Commands and Queries.......................................................................................................... B-8
B-4 Programming as a Current Stabilizer ......................................................................................................... B-11
B-5 Programming as Voltage Stabilizer ............................................................................................................ B-15
B-6 Using Status Commands and Queries ....................................................................................................... B-17
B-7 Using System Commands and Queries ..................................................................................................... B-23
and Operation Event Register Bits .......................................................................................................... B-16
and Questionable Condition Enable Register Bits ..................................................................................B-18
KLR DEVGD 020498vii
Page 10
Page 11
This manual contains instructions for digital programming of the KLR series of 1200W output
power, stabilized voltage or current, d-c power supplies manufactured by KEPCO, Inc., Flushing, New York, U.S.A. Basic operation of the front panel controls as well as analog programming
of the KLR Series is covered in the KLR User Manual. (When analog programming is in use, the
unit will still respond to digital queries related to status and readback.) Refer to the KLR User
Manual for all other installation and operating instructions.
1.1GENERAL DESCRIPTION
The KLR is a power supply class of instrument. The KLR supports all Power supply class functionality including measurement and trigger. The KLR has additional functionality beyond the
class requirements, including a 250 step list, state storage, and hyperbolic power capability. The
KLR Power Supply Series can be digitally programmed using SCPI commands and queries sent
from a computer via one of two interfaces. Standard models (also referred to as -1200 models)
include the IEEE 488.2 (GPIB) and RS 232 interface. E-Series models (formerly referred to as -
1.2K models) include the IEEE 488.2 (GPIB) and LAN interfaces.
1.1.1DRIVERS
Three instrument drivers are available which allow remote operation via virtual front panels.
•IVI-COM driver supplied with the unit [E-Series Models only] This is a state-of-the-art
driver which provides wrappers to allow use within Visual C, Visual Basic, LabView and
LabWindows/CVI environments to fully control the KLR power supply. (see Section 3).
SECTION 1 - INTRODUCTION
•LabView G driver supplied with the unit. This driver is written in native LabView code
using the VISA write and read functions. (see Section 4).
•VXI plug&play driver supplied with the unit. This driver is written in C using VISA write
and read functions. It is compliant with the VXI plug&play specification and can be used
in an ANSI compatible C program such as LabWindows /CVI. It is also portable to Linux
and Apple operating systems, however verification of these environments has not been
completed. (see Section 5).
The drivers (and the raw programming examples found in this manual), do not communicate
directly to the KLR. They use the operating system or vendor specific interface drivers to handle
the actual communication of the serial, Ethernet or GPIB cables. Vendors such as National
instruments, Agilent technologies and Keithley have created a VISA (Virtual Instrument System
Architecture) library. The VISA library uses consistent commands to open a connection, write
and read data, read the interrupt status and perform standard functions such as lock, unlock
and device clear.
The VISA libraries “open” command creates the handle for all other functions. The open command requires a resource string that provides the physical address of the unit and also specifies
the type of interface that will be used. Table 1-1 provides the resource strings for the four possible interfaces to the KLR. All KLR Models include the GPIB interface. The serial interface is
included only in standard Models; the LAN interface is included only in E-Series Models.
These drivers require a helper application (visa32.dll) to be installed on the computer being
used. VISA uses resource strings (see Table 1-1) to address the unit. The IVI-COM, and VXI
plug&play drivers require that all calls to an instrument be made through the VISA library. The
KLR-DEV 0607131-1
Page 12
LabView G driver also uses VISA calls, allowing it to work on all ports of the KLR. The examples
given in Programming, Section 6, PAR. 6.8, all utilize VISA calls so they are universally applied.
TABLE 1-1. VISA RESOURCE STRING CORRESPONDING TO INTERFACE
INTERFACE
GPIB
SERIAL
LAN-SCPI-RAWTCIP::192.168.0.100::5025::SOCKETThis is the fastest LAN interface, similar to the serial port with
LAN-VXI-11TCIP::192.168.0.100::INSTRThis LAN interface requires a more complex handshake for data
VISA RESOURCE STRINGCOMMENT
GPIB::xx::INSTRThe GPIB address replaces xx.
ASRLy::INSTRThe com port number replaces y.
automatic XON XOFF protocol support.
and is inherently slower than a socket interface. It is similar to the
GPIB interface where you tell the device when to take data and
when it is acceptable to receive data.
1.1.2COMMUNICATION
Communication between a KLR and a computer system may be via one of three methods: IEEE
488.2, RS 232 and LAN. These three interfaces communicate by sending formatted strings to
the KLR which are then parsed to perform specific actions.
•IEEE 488.2 (GPIB) Interface (see Section 7).
•RS 232 Interface [standard models only] (see Section 8).
•LAN interface [E-Series models only] (see Section 9).
1.1.3PROGRAMMING
SCPI and IEEE 488 common commands/queries are the building blocks used to control the
KLR power supply. These sections are provided to allow a user to write their own program to
control the KLR power supply or to use the various interactive tools provided by Measurement
Computing, National Instruments, Agilent Technologies and Microsoft to send strings to a
device over the RS 232, GPIB or LAN interfaces. SCPI commands and queries are supported
by all three interfaces.
•Description of SCPI Syntax (see Section 6).
•IEEE 488 Common commands supported (see Appendix A).
•Listing of SCPI commands supported (see Appendix B).
1.2DRIVER OVERVIEW
The three drivers for KLR all have common functional groups Each group contains similar functions which work together. The four different environments, IVI-COM, LabView G, VXI
Plug&Play and Programming all have common functionality.
The KLR power supply, like most instrument power supplies, has four subsystems: output, trigger, status and measurement. In additional to these subsystems, the KLR has a storage system
and a list system. The commands to use these subsystems have been grouped by function as
detailed in the following paragraphs. These functional groupings are also used in the examples
that are presented in Sections 3 (IVI-COM Driver), 4 (LabView G Driver), and 5 (VXI plug&play
Driver).
1-2KLR-DEV 060713
Page 13
1.2.1INITIALIZATION
When an instrument is first accessed, it is desirable to have it start at a standard state and to
verify that the instrument is the correct one. These functions utilize standard commands which
are common to all power supply class instruments such as *IDN? *CLS and *RST. In the various
drivers, this functional group also includes an open and close functionality.
1.2.2OUTPUT CONTROL
The power supply class instrument has specific requirements to support voltage and current
settings, output enable and protection. These functions are common to all power supplies in the
power supply class.
1.2.3MEASUREMENT
The Power supply has the ability to measure the voltage and current at the output and display
this information on the front panel. The measurement system provides the ability to read this
back from the unit.
The KLR Power Supply can be programmed to user-defined values that can be lower than the
maximum values. For example, although the KLR 40-60 is factory set to 40V and 60A (2400
Watts), arbitrary limits, e.g., 40A@30V or 30A@35V can be established. Once the limits are set,
setting values exceeding the limit values will not be accepted. The limit model settings are password protected.
1.2.5SAVE/RECALL (STORAGE OF USER-PROGRAMMED ACTIVE SETTINGS)
The KLR Power Supply contains 40 memory locations that can be used to store active settings.
Values are stored in the nonvolatile memory and are retained when the unit is turned off. The
stored settings can then be recalled and applied as desired. See PAR. A.13 for *SAV (Save)
and A.13 for *RCL (Recall). The unit has the ability to read or set the storage locations without
affecting the output of the power supply. These setting are cleared when a calibration is performed. Recalling a location which has never been loaded with data will cause a -221,”Settings
conflict” error and the output is unchanged.
If a limit model setting (PAR. 1.2.4) is changed and a stored parameter is outside the range
established by the new limit model, when that location is recalled, the parameter recalled
appears at the output as the default minimum (zero V or minimum A), but the stored value is
unchanged, and no error message is issued.
1.2.6LIST (USER-PROGRAMMED SEQUENCES)
Using the LIST functions, up to 250 locations are available for programming the KLR output.
These locations enable the user to program the output using multiple command sequences
which may be initiated by a single command (see PARs B.9 through B.29). The repeatable userdetermined sequences are stored in volatile memory and are retained until reprogrammed, the
power supply is turned off, a calibration is performed, a LIST:CLEar command is received, or
limit model settings are changed.
Each location defines values for the active channel (either output voltage or output current), a
dwell time duration (between 0.010 and 655.36 seconds) for the programmed settings, and the
state of the internal relay. By programming the output to change in small increments, complex
outputs can be generated.
KLR-DEV 0607131-3
Page 14
NOTES: 1. When programming sequential voltage levels, it is important to set the Overvoltage
1.2.7STATUS
The KLR status system consists of the standard register configuration as defined by the IEEE
488.2 and SCPI standards. This configuration allows the errors to be reported and causes interrupts to be sent to the computer. The drivers provide the ability to set and clear these registers
but the interrupt functionality is not supported by the drivers. Using interrupts requires special
programming techniques that are environment-specific. See PAR. 1.2.7.1 through 1.2.7.5 for
details on the process required to implement this in a VISA environment.
to accommodate the highest voltage of the sequence. Otherwise, when going from
higher to lower voltage levels, the overvoltage protection will trip and shut down the
unit because the overvoltage setting registers faster than the power supply can
attain the lower voltage.
2. To operate the internal relay using the LIST commands, first configure the internal
relay to LIST using the UTIL menu from the front panel (see KLR User Manual).
3. The message dLST appears in the front panel status display while a LIST program
is running.
4. Removing the unit from remote digital programming mode will immediately terminate a running LIST program.
5. The LIST capability is disabled for master /slave configurations and all LIST commands will generate error message -221,”Configuration conflict.”
The serial poll response of the KLR power supply provides summary bits of the status and error
reporting system. (The simplest status report is the “command valid” reporting and data availability. The successful decoding of a command string generates no error and is indicated by the
bit 3 of the serial poll response being a zero.) The setting of bit 4 in the status byte indicates
data is available to the controller in response to a command query message.
1.2.7.1STATUS REPORTING STRUCTURE
The status reporting of the KLR uses four status register sets, illustrated in Figure 1-1. These
register sets are the Questionable, Operation, Event Status and Status Byte register sets. The
Questionable and Operation registers are 16 bit registers whose inputs are unique to each
instrument, while the Event Status and Status Byte registers are 8 bit registers with standard
inputs defined by IEEE 488.2. Each of these four register sets is comprised of event and enable
registers, with the Questionable and Operation sets adding condition and transition registers.
The Questionable and Operation condition registers hold unlatched events reported in real-time
by the instrument, viewable at any time using the appropriate query. The contents of the Questionable and Operation condition registers are latched in the corresponding event registers,
which hold records of specific event occurrences as determined by the accompanying transition
register; for KLR, all transition register bits are configured to record low-to-high (0 to 1) bit states
only, so that a 1 in the condition register is always stored as a 1 in the event register. Since the
event register bits are reset when read, the event register provides a record of changes in status
since the last time the event register was read.
For all four register sets the contents of each event register is gated by an accompanying
enable register. The user must set the corresponding enable bit value to one (high) in order to
include the specific event bit in the reported status.
1-4KLR-DEV 060713
Page 15
For example, if an overvoltage error is detected, bit 0 of the Questionable Status Condition register is set. The 0 to 1 transition causes bit 0 to be stored as a 1 in the corresponding Event register. If bit 0 of the Questionable Status Enable register has bit 0 set, bit 3 of the Status Byte
(STB) register is asserted. If bit 3 of the Service Request Enable (SRE) register is also set to 1,
then bit 6 of the STB is set to 1 (true), causing the power supply to assert the SRQ line to the
host computer.
FIGURE 1-1. STATUS REPORTING STRUCTURE
KLR-DEV 0607131-5
Page 16
When the service request is executed, the STB register bits are read: bit 3 set indicates Questionable Status; bit 2 set indicates the error/event queue is not empty; bit 4 set indicates that a
message is available in the output buffer. bit 5 set indicates event status; bit 7 set indicates
operation status. The host computer program might then issue a query to read one of the indicated register set.
Reading an Event or Condition register clears all of the bits found in that register. Event register
contents are also cleared when the *CLS command is received. Condition register bits are only
cleared when the corresponding condition is not present.
1.2.7.2STATUS BYTE REGISTER SET
The Status Byte register set is comprised of the Status Byte (STB) and the Service Request
Enable (SRE) registers. The STB register is read by issuing the *STB? query (see Appendix A,
PAR. A.15). The SRE register is read using the *SRE? query (see Appendix A, PAR. A.14) and
modified using the *SRE command (see Appendix A,.PAR. A.13), except that bit 6 (request for
service) of STB is not masked by SRE.
•0 - Not Used - always 0.
•1 - LIST Running - 1 indicates that a LIST sequence is presently running. Read (and
clear) Operation Event register using STAT:OPER?
•2 - Error Queue — 1 indicates error queue is not empty. Read error queue using
SYST:ERR?
•3 - Questionable Status Summary — 1 indicates a Questionable Status register bit has
been set (see Appendix B, Table B-5 for details). Read (and clear) Questionable Event
register using STAT:QUES?.
•4 - Message Available — 1 indicates a message is waiting in the output buffer.
•5 - Event Status Summary — 1 indicates an Event Status register bit has been set. Read
(and clear) Questionable Event register using *ESR?.
•6 - Service Request — Either RQS (Request for Service) or MSS (Master Status Summary (see Appendix A, PAR. A.13 for details).
•7 - Operation Status Summary — 1 indicates an Operation Status register bit has been
set (see Appendix B, Table B-5 for details). Read (and clear) Operation Event register
using STAT:OPER?.
1.2.7.3STANDARD EVENT STATUS REGISTER SET
The Standard Event Status register set is comprised of the Event Status (ESR) and Event Status Enable (ESE) registers. The ESR register is read by issuing the *ESR? Query (see Appendix A, PAR. A.5). The ESE register is read using the *ESE? query (see Appendix A, PAR. A.4)
and modified using the *ESE command (see Appendix A, PAR. A.3).
•0 - Operation complete — 1 indicates the operation is complete and the unit is ready to
accept another command, or that query results are ready to be transferred.
•1 - Request Control — Not used (always zero).
•2 - Query Error — 1 indicates a query error has occurred (see Appendix B, Table B-5 for
details).
•3 - Device Dependent Error — 1 indicates device dependent error has occurred (see
Appendix B, Table B-5 for details).
1-6KLR-DEV 060713
Page 17
•4 - Execution Error — 1 indicates execution error has occurred (parameter exceeded
allowable range) (see Appendix B, Table B-5 for details).
•5 - Command Error — 1 indicates a command syntax error has occurred (see Appendix
B, Table B-5 for details).
•6 - User Request — Not used (always zero).
•7 - Power On — set once upon power-up, however ESE bit 7 set to 0 prevents Status
Byte bit 5 from being set.
1.2.7.4OPERATION STATUS REGISTER SET
The Operation Status register set is comprised of condition, transition, event and enable registers (see Figure 1-2). Appendix B, PAR’s B.58 through B.61 provide detailed explanations of the
queries/commands for reading and modifying these registers as applicable; the transition register cannot be modified.
The Operation condition registers record conditions which are a part of the instrument’s normal
operation. The definition of each of these bits (condition register) is as follows:
•0 through 4 — Not used (always zero).
•5 - Waiting for Trigger Summary — 1 indicates the unit is waiting for trigger
•6 and 7 — Not used (always zero).
•8 - Constant Voltage — 1 indicates the instrument is in constant voltage mode.
•9 — Not used (always zero).
•10 - Constant Current — 1 indicates the instrument is in constant current mode.
•11 through 13 — Not used (always zero).
•14 - Program Running — 1 indicates the program is running.
•15 — Not used (always zero).
1.2.7.5QUESTIONABLE STATUS REGISTER SET
The Questionable Status register set is comprised of condition, transition, event and enable registers (see Figure 1-2). Appendix B, PAR’s B.63 through B.66 provide detailed explanations of
the queries/commands for reading and modifying these registers as applicable; the transition
register cannot be modified.
The Questionable Condition register (see Figure 1-1) contains status bits representing data/signals which give an indication of the quality of various aspects of the signal.
KLR-DEV 0607131-7
Page 18
A bit set in the Questionable Condition register indicates that the data currently being acquired
or generated is of questionable quality due to some condition affecting the parameter associated with that bit.
•0 - Overvoltage Error — 1 indicates an overvoltage fault has been detected.
•1 - Overcurrent Error — 1 indicates an overcurrent fault has been detected.
•2 - Power Lead Error — 1 indicates that output lead connections are not complete.
•3 - Overtemperature Error — 1 indicates a thermal error has been detected.
•6 - Master/Slave Error — 1 indicates communication error between master and slave
units.
•7 - 15 — Not used (always zero).
1.2.7.6ERROR/EVENT QUEUE
The Error/Event queue is a FIFO (first in first out) buffer that stores errors as they occur. As it is
read, each error is removed from the queue and the next error message is made available.
When all errors have been read, the query returns 0,”No error”.
If more than 15 errors are accumulated, it will overflow. When overflow occurs, the oldest errors
stay in the queue, but the most recent errors are discarded. The last error in the queue will be 350,”Too many errors.” Error messages are defined in Appendix B, Table B-5.
1.2.8TRIGGER
The KLR unit has the ability to utilize both a software trigger and an external (hardware) trigger.
Model 1-2.K units have an additional software trigger capability accessed via Port 5044. When a
trigger event is properly enabled and received, the output voltage and current are set to the preset trigger levels.
The TRIG:SOUR command (see PAR. B.107) determines whether the external (hardware)
(EXT) or software (INT) trigger is selected.
If external trigger mode is selected, the hardware trigger is activated by grounding the
EXT_TRG line (J2 pin 14 to pin 9, 11, 13 or 15); this creates the trigger event at which time the
trigger values (preset values VOLT:TRIG and CURR:TRIG) will become the setpoint values
(Vset and Cset) for the power supply. Refer to PARs. B.44, B.56, and B.94. The VOLT:TRIG
and CURR:TRIG values are reset to the default minimum (zero V or minimum A) when the unit
is calibrated or if a limit model setting is changed.
If software trigger is selected, trigger events are activated by *TRG (see PAR. A.16) or a GPIB
<GET> command.
1-8KLR-DEV 060713
Page 19
2.1INTRODUCTION
Figure 2-1 shows all paths used to communicate with the KLR. These include local control from
the front panel, GPIB, LAN (Ethernet) for E-Series models only, and RS 232 for standard models only.
SECTION 2 - COMMUNICATION
LAN (ETHERNET) **
WEB PORT 80
(8 CONNECTIONS)
HOME PAGE
(UNIT DESCRIPTION)
LAN
CONFIGURATION
PAGE
OPERATE
INSTRUMENT
PAGE
STATUS
DISPLAY
FRONT PANEL
STATUS
SCPI RAW
PORT 5025
2 CONNECTIONS
SUNRPC
PORT 111
UDP BROADCAST
SUNRPC
PORT 111
TCP/IP
VXI-11
PORT 1024
4 CONNECTIONS
CLASS A/B
UDP LXI
TRIGGER
PORT 5044
TCP/IP
TRIGGER
PORT 5044
TELNET
PORT 5024
2
CONNECTIONS
LAN PORT
LOCKING
INSTRUMENT
FUNCTIONS
LOCAL CONTROL
SCPI, 488.2 LOCKING
GPIB
CONNECTION
RS 232
CONNECTION *
REAR PANEL
3043146
* STANDARD MODELS ONLY
** E SERIES MODELS ONLY
FIGURE 2-1. KLR COMMUNICATION, BLOCK DIAGRAM
2.2FRONT PANEL (LOCAL) CONTROL
Front panel control is the default upon power up (see the KLR User Manual). The unit automatically enters remote mode upon receipt of a remote command. The front panel can be locked
and unlocked in all environments as shown in Table 2-1.
KLR-DEV 0607132-1
Page 20
TABLE 2-1. FRONT PANEL LOCKOUT COMMANDS
EnvironmentCommandDescription
ProgrammingSYSTem:KLOCk Follow with on or off. Setting on locks the front panel.
VXI plug&playKp_KLR_SetResetKeyblockRequires the instrument session and a Boolean value of 0 for off and 1
LabView GKepco Serial initialize with optionsThe input defaults to lock the keyboard.
IVI-COMRequires the instrument session and a Boolean value of 0 for off and 1
to lock the keyboard.
to lock the keyboard.
2.3DIGITAL CONTROL VIA LAN [E-SERIES MODELS ONLY]
Figure 2-1 shows all the ports available to the LAN interface. These port are described in Section 9, LAN INTERFACE [E-Series MODELS ONLY], and include:
•Port 80 - Web Interface. (See KLR User Manual for details on how to use the web interface.) This port supports up to eight connections. For details as to how to access, operate and configure the unit using the web interface, refer to the KLR User Manual. In
addition, the web interface is compatible with \\LXI\instrument.xml and
\\LXI\instrument.xsd required by Version 1.2 of the LXI specification.
•Port 111 - SUNRPC (UDP Broadcast and TCP/IP). The SUNRPC port is used for discovery when sent as a UDP broadcast message. The only command supported is the GETPORT. The ports that can be requested are detailed in the VXI specification and
repeated in the LXI specifications. The SUNRPC port can be also used with the TCP/IP
protocol. Again, the only command supported is the GETPORT. Port 111 is the method
(called the Discovery process) used by National Instruments and Agilent to find the
resource. KLR E-Series Models support the discovery process implemented by Version
1.1 of the LXI Specification using this port and a VXI-11 protocol, as well as the XML protocol proposed by Version 1.2 of the LXI specification.
•Port 1024 - VXI-11. This port supports up to two connections. VXI-11 uses one standard port (1024) and two assigned by the instrument when connections are opened. The
1024 port is open at all times to accept connection requests. The VXI-11 port requires
the use of a lock which prevents other VXI-11 connections from gaining access to the
instrument. This port is accessed using the VISA resource string ending in INST, e.g.:
TCIP0::192.168.1.100::INST
•Port 5024 - Telnet. This port supports up to two connections. the Telnet command provided with all windows operating systems can be run with the following command line
(use Start - Run) TELENET IPADDRESS PORT e.g.:
TELNET 192.168.0.100 5024
When the program is run, entering commands found in Appendix A and B of this Developer’s Guide allow the operation of the unit via the Telnet port.
2-2KLR-DEV 060713
Page 21
•Port 5025 - SCPI Raw. This port supports up to two connections. The SCPI-Raw port
provides faster access than the VXI-11 port (1024) as it has little overhead. This port is
accessed using the VISA resource string, e.g.:
TCIPO::192.168.1.100::5025:SOCKET
•Port 5044 - Trigger Port (UDP LXI and TCP/IP).
2.4DIGITAL CONTROL VIA GPIB
KLR Power Supplies may be programmed over the IEEE 488 standard communication bus
(General Purpose Interface Bus, GPIB) control bus using SCPI (Standard Commands for Programmable Instruments). Use the SYST:COMM:GPIB:ADDR? query to read the current GPIB
address. Use the SYST:COMM:GPIB:ADDR command to change it. Refer to Section 6, PROGRAMMING THE KLR USING SCPI COMMANDS, and Section 7, IEEE 488.2 (GPIB) INTERFACE. for additional details on using the GPIB interface.
2.5DIGITAL CONTROL VIA RS 232 [STANDARD MODELS ONLY]
KLR standard models may be programmed over the RS 232 control bus using SCPI (Standard
Commands for Programmable Instruments) (see Section 6). All power supply functions available from the front panel can be programmed via remote commands, as well as some that are
not available from the front panel: Save/Recall (see PAR. 1.2.5) and List (see PAR. 1.2.6). Refer
to Section 8, RS 232C INTERFACE [STANDARD MODELS ONLY] for additional details on
using the RS 232 interface.
The KLR Power Supply may be operated via an RS232-C terminal, or from a PC using a terminal emulation program. Refer to KLR User Manual for RS 232 connections.
All RS 232 parameters may be changed using SCPI commands (see Appendix B) as follows:
•To enable RS 232, refer to PAR’s B.86 and B.87
•For baud rate, refer to PAR’s B.82 and B.83
•For prompt, refer to PAR’s B.90 and B.91;
•For echo, refer to PAR’s B.84 and B.85;
•For XON/XOFF, refer to PAR’s B.88 and B.89.
The default settings are as follows:
•Baud rate: 38400
•Parity:None
•Data Bits8
•Stop Bits1
•EchoOFF
•XONON (enabled)
KLR-DEV 0607132-3
Page 22
NOTE: Kepco strongly recommends the XON XOFF method for data transfer via RS 232 protocol for all Kepco products. If this method is not selected, it is the user's responsibility to ensure
completion of any response by the power supply prior to issuance of subsequent commands.
The XON XOFF method allows the KLR Power Supply to control when the command originator
is allowed to send data. The command originator can only send data after the XON (transmission on) character (011
receiving the XOFF (transmission off) character (013
) has been received; the command originator stops sending data after
H
), and waits until the XON character is
H
received before sending additional data.
Control characters, either CR or LF, are returned as XOFF CR if echo mode is on, and as XOFF
if echo mode is off. XOFF stops data from the command originator and the KLR returns the normal sequence of CR LF (if echo mode is enabled).
Prior to use, the RS 232 port must be initialized be sending either CR, LF or ESC.
The RS 232 port of the KLR must be configured properly to work with the three drivers (see
Table 2-2). The baud rate is not automatically detected and must be set correctly by the user
using either the front panel, LabView G, VXI plug&play or Programming environment. The IVICOM driver can not modify RS 232 setup. In the VXI plug&play environment the program must
use the Kepco Serial Initialize routine instead of the standard KpKLRInit routine.
TABLE 2-2. RS 232 SETUP
EnvironmentMethod
IVI-COMAutomatically enabled
LabViewAutomatic - uses Kepco Serial Initialize
VXI plug&playKpKLR_Serial Initialize
2-4KLR-DEV 060713
Page 23
SECTION 3 - IVI-COM DRIVER
3.1INTRODUCTION
The IVI-COM (Interchangeable Virtual Instrument) driver provided with the instrument allows
remote programming of the unit via either the LAN, GPIB or RS 232 ports.
The IVI-COM (Interchangeable Virtual Instrument) driver provided with the instrument can be
used with many Kepco power supplies. The KLR does not support all features found in the
driver, specifically those related to the Bipolar type power supplies. It allows remote programming of the KLR via either the LAN (E-Series models only), GPIB (all models) or RS 232 (standard models only) ports.
This driver supports the IviDCPwr class-compliant interface and fulfills all requirements imposed
by IVI-4.4: IviDCPwr, Revision 2.0. The driver implements all of the class capabilities from the
IviDCPwr specification for which the instrument has matching functionality. The Kepco KLR IVICOM driver does not support the configuring and resetting of overvoltage and overcurrent conditions.
3.1.1SPECIFICATION COMPLIANCE
The IVI Foundation provides several specifications outlining the criteria for compliance with the
IVI-COM driver architecture. The chief aim of these specifications is to ensure compatibility with
specific IVI-COM infrastructure components, thereby increasing the degree of driver and instrument interchangeability. This IVI-COM driver complies with the following IVI standards:
•• IVI 3.3 - Standard Cross-Class Capabilities Specification
•• IVI 3.4 - Guidelines for API Style
•• IVI 3.5 - IVI Factory Specification
•• IVI 3.6 - IVI Configuration Server Specification
The driver is built upon the National Instruments VISA-COM interface.
3.1.2RANGE CHECKING AND COERCION
The driver will predominantly rely upon the instrument to perform range checking and coercion.
3.1.3MULTITHREADING SUPPORT
Multithread safety is provided using standard operating system primitives for object locking. This
driver uses method-level locking, so that the driver can operate properly in multithreaded applications.
KLR-DEV 0607133-1
Page 24
3.1.4CONTEXT-SENSITIVE HELP
The driver includes both HTML 1.x and HTML 2.0 help files which document the following driver
elements:
•Interfaces
•Methods
•Method parameters
•Properties
3.1.5INSTALLER
A stand-alone installer, file KepcoDCPwr.0.1.0.0.msi, using Microsoft MSI technology may be
downloaded from the Kepco website at www.kepcopower.com/drivers.
NOTE: The filename of the installer, either on our web site or sent via e-mail, will have .delme
added to the end of the file. After downloading the file, it must be renamed, deleting
.delme. The .delme extension allows the driver to pass through most firewalls. The
.msi extension indicates the file is a system update file and many networks prohibit
them. Once it is renamed, it can be installed on the computer by double clicking the file.
This installer complies with all of the installer requirements of Section 6 of IVI-3.1: Driver Architecture Specification.
The installer checks to insure the IVI foundation class components of the proper revision are
installed. It also verifies the VISA-COM driver is properly registered. If these checks fail, the
installer provides instructions on how to repair the problem. The installer will not install the
Kepco driver unless the IVI foundation class is installed. If VISA-COM problems are detected,
they are reported with suggestions for repair, but do not stop the driver from installing and registering the files.
3.1.6RIGHTS
The IVI-COM driver was written by Kepco for use on Kepco products. It was written using
Pacific Mindworks Nimbus system. It is intended for use with Kepco power supplies. Disassembly and/or modification of the IVI-COM driver is expressly forbidden.
3.2IVI-COM INSTRUMENT DRIVER FUNCTIONS
Table 3-1 is a list of the KLR IVI-COM driver functions. The installed help file provides detailed
information on these functions and all functions in the driver. This driver is both a DCPWR class
driver and a Kepco Specific driver. The DCPWR class driver requires the class specific attribute
to be accessed as a member in a structure. The standard functions such as enabling the output,
setting the voltage level, setting the current level are handled in this manner.
A setting in Table 3-1 is identified by the variable being in all caps. Functions use both upper and
lower case letters in the function name. When a setting is to be modified, then the functions
KpDCPwr_SetAttributeViBoolean, or KpDCPwr_SetAttributeViReal64 are used to update the
variable and the functions KpDCPwr_GetAttributeViBoolean or KpDCPwr_GetAttributeViReal64
are used to get the variable. When one of these class-specified variables are modified, its value
is maintained in the driver. When the get or read of the variable is called for, the internal state
variable is returned. This behavior can be modified by making the KPDCPWR_ATTR_CACHE
attribute false. It defaults to a true state as required by the IVI conventions.
3-2KLR-DEV 060713
Page 25
TABLE 3-1. KLR IVI-COM DRIVER FUNCTIONS
Function NamePurpose
Initialization
KpDCPwr_initInitialize Power supply, create session handle.
KpDCPwr_InitWithOptionsInitialize power supply, allowing user to determine reset and identifi-
KpDCPwr_closeClose session handle.
KpDCPwr_LockSessionPrevents other instrument tasks from accessing unit.
KpDCPwr_UnlockSessionAllows other instrument tasks to access unit.
KpDCPwr_resetSends reset to unit setting output off
KpDCPwr_revision_queryGets the revision level of the power supply
KpDCPwr_AttachToExistingCOMSessionAllows second usage of driver
KpDCPwr_serial_queryGets the serial number of the power supply
KpDCPwr_cal_date_queryGets the calibration date of the power supply
Output Control Functions
KPDCPWR_ATTR_OUTPUT_ENABLEDBoolean is used to set the output on and off with this attribute
KPDCPWR_ATTR_VOLTAGE_LEVELSets or reads back the output voltage of power supply.
KPDCPWR_ATTR_CURRENT_LIMITSets and read back the output current level.
KPDCPWR_ATTR_POSITIVE_CURRENT_LIMITSets the current limit level.
KpDCPwr_MeasureCurrentMeasure current function.
KpDCPwr_MeasureVoltageMeasure Voltage function.
KPDCPWR_ATTR_OUTPUT_MODEIndicates if unit is in voltage or current mode of operation, read only
KPDCPWR_ATTR_POSITIVE_CURRENT_PROTECTION
_LIMIT
KPDCPWR_ATTR_POSITIVE_VOLTAGE_PROTECTION
_LIMIT
KPDCPWR_ATTR_TRIGGERED_CURRENT_LEVELSets the current trigger level.
KPDCPWR_ATTR_TRIGGERED_VOLTAGE_LEVELSets the triggered voltage level of the power supply.
KPDCPWR_ATTR_TRIGGERED_CURRENT_LIMITSets the triggered current protect level of the KLR.
KPDCPWR_ATTR_TRIGGER_SOURCESets and views the trigger source.
KPDCPWR_ATTR_INIT_CONTINUOUSEnables continuous or single trigger events.
KpDCPwr_ConfigureTriggerSourceAllows selection of the trigger source from External or software trig-
KpDCPwr_ConfigureTriggeredCurrentLimitSends the current trigger level to the power supply.
KpDCPwr_ConfigureTriggeredVoltageLevelSend the voltage trigger level to the power supply.
KpDCPwr_AbortSends abort to the KLR, preventing a trigger event from changing
KPDCPWR_ATTR_POSITIVE_CURRENT_RATED_LIMITLimit model current limit
KPDCPWR_ATTR_POSITIVE_VOLTAGE_RATED_LIMIT Limit model voltage limit
KpDCPwr_DisablePasswordStateTurn off password enable
KpDCPwr_ChangePasswordAllows for changing the password of the power supply.
executed.
ously.
make list execute forever.
sets this variable to 1.
Utility
3.3EXAMPLES USING C
The examples illustrated in the following paragraphs are installed in the ivi\drivers\kepco\examples folder during installation of the IVI-COM driver. Figures showing the complete code for each
example are provided
3.3.1SETTING THE OUTPUT TO A VALUE AND MAKING A MEASUREMENT
The filename for this example is C output example.txt, located in the ivi\drivers\kepco\examples
folder (see Figure 3-1 for complete code).
All programs written in C++ must open the driver and include some standard H files.
3-4KLR-DEV 060713
Page 27
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This program demonstrates how to set a voltage and current
and measure the output voltage using the IVI-COM driver.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
The driver dll’s must be loaded and initialized to operate:
hr = CoInitialize(NULL);
if (FAILED(hr))
exit(1);
// create a safe pointer for interface access
IKLRPtr driverPtr=NULL;
hr = driverPtr.CreateInstance(__uuidof(KepcoDCPwr));
if (FAILED(hr))
exit(1);
Once initialized, communication with the KLR must be established. The following code shows
how to open the driver at GPIB address 6. The id query is set to true. Failure to id query to true
will reduce the functionality of the driver to the DCPWR class capabilities, preventing functions
such as setting the limit model, list and other advanced features of the KLR from being
accessed.
// open the instrument for communication
hr = driverPtr->Initialize(
"GPIB0::6::INSTR", //Visa address,(not applicable if simulation=true)
VARIANT_TRUE, // ID query
VARIANT_TRUE, // Reset
LPCTSTR("Cache=true, InterchangeCheck=false, QueryInstrStatus=true,
Simulate=false")); //IVI options
The driver is a linked list of pointers to properties and functions. To read a property, it is necessary to locate the property. The following shows how to read the firmware revision of the KLR.
To read this property the identification must be performed first.
The setting of voltage and current is then very simple.
// set voltage
hr = outputPtr->VoltageLevel(75.0);
if (FAILED(hr))
exit(1);
// set the current limit
hr = outputPtr->CurrentLimit(10);
if (FAILED(hr))
exit(1);
// enable the output
outputPtr->Enabled = true;
Sleep(500);
Note that a measurement requires accessing a function, not a variable.
// measure the voltage
double measVoltage;
measVoltage = measurementPtr->Measure(KepcoDCPwrMeasurementVoltage);
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This program demonstrates how to set a voltage and current
measure the output voltage
using the IVI-COM driver.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// set voltage
hr = outputPtr->VoltageLevel(75.0);
if (FAILED(hr))
// enable OV protection and set the limit.
hr = protectionPtr->ConfigureOVP(10);
if (FAILED(hr))
// set the current limit
hr = outputPtr->CurrentLimit(10);
if (FAILED(hr))
// enable the output
outputPtr->Enabled = true;
Sleep(500);
// measure the voltage
double measVoltage;
measVoltage = measurementPtr->Measure(KepcoDCPwrMeasurementVoltage);
//print out voltage measurement
printf("measured voltage : %f V \n",measVoltage);
}
catch(_com_error err)
{
printf("%s", err.Description());
}
//IVI options
exit(1);
exit(1);
exit(1);
exit(1);
return 0;
}
FIGURE 3-1. EXAMPLE OF SETTING THE OUTPUT AND TAKING A MEASUREMENT,
WRITTEN IN C++ (SHEET 2 OF 2)
KLR-DEV 0607133-7
Page 30
3.3.2USING A LIST TO PERFORM A SERIES OF OPERATIONS
The filename for this example is Clistexample.txt, located in the ivi\drivers\kepco\examples
folder (see Figure 3-2 for complete code).
This example is written in C# and applies to a KLR 75-32 (either standard or E-Series model).
Step sizes may need to be readjusted for other models. This example will not work for units configured for master/slave operation.
Since the IVI-COM driver is a native application for the C# and the VB.NET environments, it is
the easiest to use. More information about the various programming environments can be found
in the kepcoDCPwr driver help file which is automatically installed during driver installation.
Initializing the driver is easy; only the driver name is required.
The list is set to perform the required number of executions, then started:
// Set the number of executions.
listPtr.count = 2;
// initiate
outputPtr.listInitiate();
The driver should be closed at the end using the following code. The conditional statement
allows the close to be added to the end of the program without getting any runtime errors.
//' Close driver if initialized.
if (KLRdriver.Initialized == true ) KLRdriver.Close();
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'This program executes a 6 point current and voltage list.
' It also specifies 6 different dwell times.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
using System;
using KepcoDCPwr.Interop;
namespace ListExample
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
The CVI environment is aware of the IVI directory structure and will automatically locate the
directories containing the files without adding any path statements. It is an advantage of using
CVI over other C environments as it is IVI aware.
When the resource string is entered and the user clicks the appropriate button, the driver is
invoked and the password is established with the following code.
The user is then provided another form. When the data is entered, the standard CVI logic is
invoked and the variables are read from the form, then sent to the KLR.
The setting the KLR’s voltage is performed by two lines of code. The first line is the standard
CVI method of getting a variable from the form and the second line is the function in the IVI
driver that sets an attribute to a specific value.
// Get the desired voltage limit from the UI
GetCtrlVal(panelHandle, PANEL_VOLTAGE_LIMIT, &voltageLimit);
// Set the voltage limit
checkErr(KpDCPwr_SetAttributeViReal64(vi, VI_NULL,
The setting of a maximum current level for the limit model is performed using the same two
functions but the attribute is changed on the set function.
// Get the desired current limit from the UI
GetCtrlVal(panelHandle, PANEL_CURRENT_LIMIT, ¤tLimit);
// Set the current limit
checkErr(KpDCPwr_SetAttributeViReal64(vi, VI_NULL, //
KLR-DEV 0607133-11
Page 34
The functions above used a function checkErr which is part of the project file KpDCPwrEr-
rorHandler.c. This file has calls to two functions: KpDCPwr_GetError and
KpDCPwr_error_query. These two functions check for errors and provide readable text of the
error messages.
KpDCPwr_GetError(vi, &errorCode, bufferSize, pos);
// Display the error from the instrument, if that is the source
if (errorCode == KPDCPWR_ERROR_INSTRUMENT_STATUS)
{
KpDCPwr_error_query(vi, &errorCode, buffer);
}
MessagePopup("Error!", buffer);
3.4EXAMPLES USING VISUAL BASIC
The following paragraphs are example of how to use code written in Visual Basic to set the output and take a measurement, and how to use a list to perform as series of operations
3.4.1SETTING THE OUTPUT TO A VALUE AND TAKING A MEASUREMENT
The following example, written in Visual Basic, sets the output to a value and then takes a measurement. The filename for this example is VBOutputExample.txt, located in the ivi\drivers\kepco\examples folder (see Figure 3-3 for complete code).
Note that Visual Basic has its own methods to support the IVI-COM driver.
Public driver As KepcoDCPwr
Public outputPtr As IKLROutput
Public protectionPtr As IKLRProtection
Public measurementPtr As IKLRMeasurement
Set driver = New KepcoDCPwr
Once the driver is initialized, the connection between host and KLR is established using a standard VISA resource string. It is important that the initialize function be passed as true since its
second argument allows KLR-specific features to be enabled, however in this example, no KLRspecific feature such as list is required.
' initialize the driver - note ID device is true
driver.Initialize "GPIB0::6::INSTR", _
True, _
True, _
"Cache=true,InterchangeCheck=false,Query-
InstrStatus=true,Simulate=false"
Dim result As Boolean
result = driver.Initialized
Set outputPtr = driver.Outputs.Item(driver.Outputs)
Set protectionPtr = driver.Protections.Item(driver.Protections)
Set measurementPtr = driver.Measurements.Item(driver.Measurements)
3-12KLR-DEV 060713
Page 35
Using the pointers it becomes very easy to set voltage and current. Each parameter is simply
loaded with the value to be set using individual statements.
' set voltage level
outputPtr.VoltageLevel 75
' enable OV protection and set OV level
protectionPtr.ConfigureOVP 15
' set current level
outputPtr.CurrentLimit 10
' enable the output
outputPtr.Enabled = True
Measuring the output is performed by accessing a function and not a parameter.
' Measure the voltage
Dim measVoltage As Double
measVoltage = measurementPtr.Measure(KepcoDCPwrMeasurementVoltage)
Closing the driver is the last step in any program:
driver.Close
KLR-DEV 0607133-13
Page 36
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' This program demonstrates how to set the output voltage and current
' measure the voltage
' using the IVI-COM driver.
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
Public driver As KepcoDCPwr
Public outputPtr As IKLROutput
Public protectionPtr As IKLRProtection
Public measurementPtr As IKLRMeasurement
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdStart_Click()
Set driver = New KepcoDCPwr
On Error GoTo ErrorHandler
' initialize the driver - note ID device is true
driver.Initialize "GPIB0::6::INSTR", _
True, _
True, _
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-
Dim result As Boolean
result = driver.Initialized
Set outputPtr = driver.Outputs.Item(driver.Outputs)
Set protectionPtr = driver.Protections.Item(driver.Protections)
Set measurementPtr = driver.Measurements.Item(driver.Measurements)
' set voltage level
outputPtr.VoltageLevel 75
' enable OV protection and set OV level
protectionPtr.ConfigureOVP 15
' set current level
outputPtr.CurrentLimit 10
' enable the output
outputPtr.Enabled = True
Delay 10
' Measure the voltage
Dim measVoltage As Double
measVoltage = measurementPtr.Measure(KepcoDCPwrMeasurementVoltage)
late=false"
FIGURE 3-3. SETTING THE OUTPUT AND TAKING A MEASUREMENT EXAMPLE, WRITTEN IN VISUAL
BASIC (SHEET 1 OF 2)
3-14KLR-DEV 060713
Page 37
' display the measured voltage
StatusTextBox.Text = StatusTextBox.Text & "Measured Voltage is " & measVoltage & " at chan-
StatusTextBox.Refresh
ReadInstrumentError driver
driver.Close
StatusTextBox.Text = StatusTextBox.Text & "Driver closed." & vbCrLf
StatusTextBox.Refresh
Exit Sub
ErrorHandler:
MsgBox Err.Description
driver.Close
Exit Sub
End Sub
' Wait the specified number of seconds
Private Sub Delay(DelayTime As Single)
Dim Finish As Single
Finish = Timer() + DelayTime
Do
Loop Until Finish <= Timer()
End Sub
nel " & channel
FIGURE 3-3. SETTING THE OUTPUT AND TAKING A MEASUREMENT EXAMPLE,
WRITTEN IN VISUAL BASIC (SHEET 2 OF 2)
3.4.2USING A LIST TO PERFORM A SERIES OF OPERATIONS
The filename for this example is VBListexample.txt, located in the ivi\drivers\kepco\examples
folder (see Figure 3-6 for complete code).
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'This program executes a 6 point current and voltage list.
' It also specifies 3 different dwell times.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Option Explicit
Public driver As KepcoDCPwr
Public outputPtr As IKepcoKLROutput
' get references to the needed interfaces
Set outputPtr = driver.Outputs.Item(driver.Outputs)
Set listPtr =driver.list
FIGURE 3-4. EXAMPLE OF USING A LIST, WRITTEN IN VISUAL BASIC (SHEET 1 OF 2)
KLR-DEV 0607133-15
Page 38
Delay (100)
ReadInstrumentError driver
driver.Close
Exit Sub
errorHandler:
MsgBox Err.Description
driver.Close
Exit Sub
End Sub
Private Sub ReadInstrumentError(agDrvr As IIviDriver)
' Read instrument error queue until its empty.
Dim errCode As Long
errCode = 999
Dim errMsg As String
StatusTextBox.Text = StatusTextBox.Text & vbCrLf
While errCode <> 0
agDrvr.Utility.ErrorQuery errCode, errMsg
StatusTextBox.Text = StatusTextBox.Text & "ErrorQuery: " & errCode & ", " & errMsg & vbCrLf
Wend
End Sub
' Wait the specified number of seconds
Private Sub Delay(DelayTime As Single)
Dim Finish As Single
Finish = Timer() + DelayTime
Do
Loop Until Finish <= Timer()
End Sub
FIGURE 3-4. EXAMPLE OF USING A LIST, WRITTEN IN VISUAL BASIC (SHEET 2 OF 2)
3.4.3SETTING LIMIT MODEL
The filename for this example is VBlimit model Example.txt, located in the ivi\drivers\kepco\examples folder (see Figure 3-5 for complete code). This example is very similar to
the other examples in this section. The difference is that functions in the driver are used to perform the operation instead of setting the value to a specific state. Access to the functions is
identical to the method used to access the open and close of the driver. The functions used are:
KpDCPwr_SetAttributeViReal64 which sets the various attributes to a specific value.
KpDCPwr_EnablePasswordState which sends the string to the unit to enable the ability to set
the limit model.
3-16KLR-DEV 060713
Page 39
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' This program demonstrates how to set the limit model
' using the IVI-COM driver.
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
Public driver As KepcoDCPwr
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdStart_Click()
Set driver = New KepcoDCPwr
On Error GoTo ErrorHandler
' initialize the driver - note ID device is true
driver.Initialize "GPIB0::6::INSTR", _
True, _
True, _
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-
Dim result As Boolean
result = driver.Initialized
' This will now set the limit model to a 36-32 unit.
StatusTextBox.Text = StatusTextBox.Text & "Driver closed." & vbCrLf
StatusTextBox.Refresh
Exit Sub
ErrorHandler:
MsgBox Err.Description
driver.Close
Exit Sub
End Sub
late=false"
' Wait the specified number of seconds
Private Sub Delay(DelayTime As Single)
Dim Finish As Single
Finish = Timer() + DelayTime
Do
Loop Until Finish <= Timer()
End Sub
FIGURE 3-5. SETTING LIMIT MODEL, WRITTEN IN VISUAL BASIC
3.5EXAMPLES USING LABVIEW
These LabView examples show the use of the IVI-COM driver with LabView 8. The procedure
used to create the examples is found in the KepcoDcPwr help file that was installed in the IVI
portion of your Start menu. Step by step instructions are detailed in:
•Getting Started with the IVI-COM Driver - Development Environments - Using LabView
KLR-DEV 0607133-17
Page 40
3.5.1SETTING THE OUTPUT TO A VALUE
Figure 3-6 illustrates the use of the IVI-COM driver with LabView to set the KLR output to a
value. The first two blocks show the automation controller and kepcodriver functions. These are
followed by the initialize method of the driver,
Referring to Figure 3-6, the initialize method makes the connection to the KLR using the visa
resource string. The driver supports a simulation mode of operation which is set false in the
example. The next three blocks are property nodes which are used to set the voltage, current
and output enable of the power supply. These are the properties of the power supply which
directly affect the power supply output. In LabView each property must be set separately, but
multiple outputs of the property node are allowed. The final two blocks are the close functions.
One block is the method to close (disable the output). The second block is the ActiveX close reference which performs the driver close, breaking the connection to the KLR, and the instrumentation close which releases the memory used by the driver.
FIGURE 3-6. SETTING THE OUTPUT USING LABVIEW WITH IVI-COM DRIVER
3.5.2GETTING A VOLTAGE AND CURRENT READING FROM THE POWER SUPPLY
Figure 3-7 illustrates the use of the IVI-COM driver with LabView to measure the KLR output.
3-18KLR-DEV 060713
Page 41
FIGURE 3-7. MEASURING VOLTAGE AND CURRENT USING LABVIEW WITH IVI-COM DRIVER
3.5.3CHANGING THE LIMIT MODEL
The limit model Vi is very similar to the output setting and measurement examples; it has the
identical open and close functionality. The middle three blocks set the password, then cause the
voltage limit and the current limit to be applied to the KLR. This is done using the Max Positive
Current Limit and Max Positive Voltage Limit properties. As indicated in the earlier table these
are the setting nodes that are required to change the KLR limit model.
FIGURE 3-8. SETTING THE LIMIT MODEL USING LABVIEW WITH IVI-COM DRIVER
KLR-DEV 0607133-19/(3-20 Blank)
Page 42
Page 43
4.1INTRODUCTION
The LabView G driver can be used for remote programming over all ports of the KLR (Serial and
GPIB ports [and LAN port for E-Series models only]. It is designed to operate in LabView 8.5
environments only.
NOTE: The LabView5 driver available from the Kepco website is recommended to be used
only with LabView 5 and supports remote programming only via the GPIB port of the
KLR. A LabView 6i version provides access to GPIB- and LAN-based KLR units. All
three LabView G Drivers can be downloaded from the Kepco web site at:
www.kepcopower.com/drivers/.
The older versions are found at:
www.kepcopower.com/drivers/drivers-dl3a.htm.
The LabView G driver uses VISA calls to communicate with the power supply. Since LabView
automatically installs the VISA libraries, the proper version of the library should already be
installed on your computer.
The Version 8 LabView driver is available in two formats: a standalone version that includes the
LabView runtime program, and a version that requires that LabView be installed on the computer.
SECTION 4 - LABVIEW G DRIVER
NOTE: The LabView G driver is modifiable by the user. Once any utility or function is modified,
it is the user’s responsibility to verify there are no unintended errors introduced.
4.2LABVIEW G INSTRUMENT DRIVER
The LabView G driver is a multipurpose driver. It is capable of operating all Kepco Power supplies using LabView Version 8 except for multiple output units such as MST. The LabView G
driver does not report model-specific errors but, using case structures, passes the function and
an appropriate model- specific response to the user’s program.
4.3LABVIEW G INSTRUMENT DRIVER FUNCTIONS
Kepco’s KLR LabView G instrument driver provides programming support for Kepco’s KLR
Power Supply. It contains functions for opening, configuring, taking measurements from, testing,
calibrating and closing the instrument. To successfully use this module, the instrument must be
connected to either the LAN or the GPIB.
The driver supports all functions of the KLR except the instrument state commands of Store,
Recall and Memory Read. The driver is also supplied with some simple examples and an interactive demo program. Users that are modifying the driver are encouraged to copy parts of this
program to maximize usage of tested functional sections. Table 4-1 lists the functions that are
available.
KLR-DEV 0607134-1
Page 44
TABLE 4-1. KLR LABVIEW G DRIVER FUNCTIONS
Function NamePurpose
KepcoDCPWR initialize with optionsMakes Visa Connection. Creates Open handle
KepcoDCPWR initializeMakes Visa Connections, No Reset, IDN is parsed and Kepco
Kepco Serial initialize with optionsMakes Visa Connection. Creates Open handle
KepcoDCPWR closeCloses the driver, freeing resources
Recognize ModelSends *IDN? And verifies KEPCO string returned
KepcoDCPWR IDN parserParse the IDN string – determining model
KepcoDCPWR Revision QueryUses IDN parser to determine firmware revision
KepcoDCPWR ResetSends *RST to Power supply, set output off, volt=0, curr min,
KepcoDCPWR Reset with DefaultsSupplied for compatibility purposes uses above
KepcoDCPWR Self-testSends *TST? To unit and returns result- o= all okay.
Output Control functions
KepcoDCPWR Configure Voltage LevelSet voltage output setting to a specific value
KepcoDCPWR Configure Current LevelSets current output setting to a specific level
KepcoDCPWR Query Voltage LevelQueries unit and returns voltage level setting
Provides ability to issue Reset and parse IDN
model is properly identified.
Provides ability to issue Reset and parse IDN
over voltage and over current to max values
KepcoDCPWR Query Current LevelQueries unit and returns Current level setting
KepcoDCPWR Configure Voltage LimitSet virtual voltage setting to a specific value
KepcoDCPWR Configure Current LimitSets virtual current setting to a specific level
KepcoDCPWR Query Voltage LimitQueries unit and returns limit model voltage level setting
KepcoDCPWR Query Current LimitQueries unit and returns limit model Current setting
KepcoDCPWR Configure OVPSet over voltage setting to a specific value
KepcoDCPWR Configure OCPSets Over current setting to a specific level
KepcoDCPWR Configure Output StateSets output on or off
KepcoDCPWR Query Output StateReturns Output on(1) or off(0).
Measurement
KepcoDCPWR Measure [MSR]Returns the voltage read back 9 default or Current read back
List Functions (supported in standalone configurations only)
KepcoDCPWR Configure Current ModeSets unit to List or Fixed mode of operation. Fixed operation is
KepcoDCPWR Configure Voltage ModeSets unit to List or Fixed mode of operation. Fixed operation is
KepcoDCPWR Configure User SequenceInitializes list from an array of either voltage and dwell or Cur-
value from KLR.
default
default
rent and dwell to execute the list a number of times.
4-2KLR-DEV 060713
Page 45
TABLE 4-1. KLR LABVIEW G DRIVER FUNCTIONS (CONTINUED)
Function NamePurpose
KepcoDCPWR Clear All ListsClears the list if not executing.
KepcoDCPWR Configure ListLoads a specific list from an array of numbers.
KepcoDCPWR Configure List CountInitializes the list count variable
Trigger Functions
KepcoDCPWR Configure Triggered Current LevelEstablishes the current level upon receipt of a valid trigger
KepcoDCPWR Configure Triggered Voltage LevelEstablishes the voltage level upon receipt of a valid trigger
KepcoDCPWR Configure Triggered SourceEstablishes the source for a trigger and arms the trigger sys-
tem.
KepcoDCPWR initiate[TRG]Issue a software trigger to the KLR.
KepcoDCPWR Abort [TRG]Clears the trigger system.
Error and status reporting
KepcoDCPWR Error-QueryProvides entry from the error queue of the power supply.
4.4USING THE DRIVER FUNCTIONS
The interactive example uses various driver functions of the LabView G driver. The following two
paragraphs details the inputs and outputs of two of typical VI’s used in the interactive example:
KepcoDCPwr Configure Voltage Level.vi (PAR. 4.4.1) and KepcoDCPwr Measure [MSR].vi
(PAR. 4.4.2). An overall block is provided for each function which shows inputs and outputs, followed by detailed descriptions of inputs and outputs. A detailed block diagram with associated
text is also provided to show how the function is implemented.
4.4.1KepcoDCPwr Configure Voltage Level.vi
This VI configures the DC voltage level the power supply is expected to generate.
4.4.1.1CONNECTOR PANEL
FIGURE 4-1. KepcoDCPwr Configure Voltage Level.vi CONNECTOR PANEL
4.4.1.2CONTROLS AND INDICATORS
See Table 4-2.
KLR-DEV 0607134-3
Page 46
TABLE 4-2. KepcoDCPwr Configure Voltage Level.vi INPUT/OUTPUT DESCRIPTIONS
DESCRIPTIONSYMBOL
channel name - (“”) Passes the name of the channel on which to configure the voltage level. It is not required for
most supplies and is provided for compatibility.
Valid Channel Names: 1 - 27Default Value: “”
level (0.0 volts) - Passes the DC voltage the power supply is to generate. The driver uses this value to set the
Voltage Level. The level is not checked by the driver function but is checked by the KLR or power supply.
Default Value: 0.0 volts
error in (no error) - The error in cluster can accept error information wired from VI’s previously called. Use this
information to decide if any functionality should be bypassed in the event of errors from other VI’s. The pop-up
option Error (or Explain Warning) gives more information about the error displayed (see Table 4-3).
VISA Session - The ViSession handle is obtained from the KepcoDCPwr Init or KepcoDCPwr InitWithOptions
function. The handle identifies a particular instrument session. Default Value: None
ModelIn - Model In is the type of Kepco power supply. This defines the capabilities and requirements in other
Kepco functions to insure proper operation of the command. This function works on All Kepco power Supplies:
BOP-HP, BOP-LP, KLR, STANDARD, MULTI and MULTI_PLUS. The MULTI type power supplies require a channel number to operate correctly. The constant is created by the Recognize Kepco model utility.
error out - The error out cluster passes error or warning information out of a VI to be used by other VI’s. The popup option Explain Error (or Explain Warning) gives more information about the error displayed (see Table 4-3).
VISA Session Out - The ViSession handle is obtained from the KepcoDCPwr Init or KepcoDCPwr InitWithOp-
tions function. The handle identifies a particular instrument session. Default Value: None
Model Out - The Model Out handle is obtained from the KepcoDCPwr Init or KepcoDCPwr InitWithOptions func-
tion. The handle identifies a particular instrument. Default Value: None
channel name out - (“”) Passes the name of the channel on which to configure the OVP limit.
Valid Channel Names: 1-27; Default Value: “”
TABLE 4-3. ERROR (OR EXPLAIN WARNING) CODES
status - The boolean is either TRUE (X) for an error, or FALSE (check mark) for no error or a warning. The pop-up option Explain Error (or Explain Warning) gives more information about the error displayed.
code - The code input identifies the error or warning. The pop-up option Explain Error (or Explain Warning)
gives more information about the error displayed.
source - The string describes the origin of the error or warning. The pop-up option Explain Error (or Explain
Warning) gives more information about the error displayed.
4.4.1.3BLOCK DIAGRAM DESCRIPTION
Figure 4-2 shows that the level input is converted to a string that is compatible with the power
supply, floating with 5 places to the right of the decimal (%.5f). Then, using the VISA write function, the string is sent to the power supply. The case statement in the middle of Figure 4-2
shows that all Kepco power supplies support this same functionality.
4-4KLR-DEV 060713
Page 47
FIGURE 4-2. KepcoDCPwr Configure Voltage Level.vi BLOCK DIAGRAM
Figure 4-3 shows that when the error is true (not equal to zero), the function is a null function,
passing the inputs (VISA session, Model, Channel and error) through the function without modification.
FIGURE 4-3. KepcoDCPwr Configure Voltage Level.vi ERROR BLOCK DIAGRAM
4.4.2KepcoDCPwr Measure [MSR].vi
This VI takes a measurement of the output signal and returns the measured value (see Figure
4-4.
FIGURE 4-4. KepcoDCPwr Measure [MSR].vi CONTROL PANEL
This VI has the standard inputs of all of the functions of the LabView G Driver. It also has three
orange inputs at the top of the VI (Virtual Resistance, Virtual Current, Virtual Voltage). These
inputs are used in simulation. They do not need to be connected, but provide the ability to verify
the operation without using the power supply. These simulation inputs are only used when
error in is true (indicating an error has occurred).
channel name - (“1”) Passes the name of the channel on which to configure the voltage level. It is not required
for most supplies and is provided for compatibility.
Valid Channel Names: 1Default Value: “1”
error in (no error) - The error in cluster can accept error information wired from VI’s previously called. Use this
information to decide if any functionality should be bypassed in the event of errors from other VI’s. The pop-up
option Explain Error (or Explain Warning) gives more information about the error displayed (see Table 4-3).
VISA Session - The ViSession handle is obtained from the KepcoDCPwr Init or KepcoDCPwr InitWithOptions
function. The handle identifies a particular instrument session. Default Value: None
Model Out - The Model Out handle is obtained from the KepcoDCPwr Init or KepcoDCPwr InitWithOptions func-
tion. The handle identifies a particular instrument. Default Value: None
channel name out - (“”) Passes the name of the channel on which to configure the OVP limit.
Valid Channel Names: 1; Default Value: “”
Figure 4-5 is a block diagram which shows the method used by the VI to perform the simulated
current measurement. The query MEAS:CURR? is transmitted to the power supply which
replies with the current measurement.
Figure 4-6 shows the use of the Kepco subvi's to initialize the driver and the device, set the output on or off, establish a voltage and current setting, get a measurement and unit status, and
close the session to release the memory. The file is KepcoDCPwr Voltage Application Example.vi It is located in program files\national Instruments\labview\drivers\kepco. The subvi’s used
to implement this example are described in the following paragraphs. Although the LabView G
driver provides a variety of functions (see Table 4-1), only the ones shown in Figure 4-6, needed
for this example.
4-6KLR-DEV 060713
Page 49
4.5.1INITIALIZATION FUNCTION
The initialization function use three subvi’s:
•KepcoDCPWR initialize - Initializes the driver.
•KepcoDCPWR Query Voltage Limit - Verifies the limit model voltage setting.
•KepcoDCPWR Configure Voltage Mode - Sets Mode to fixed, thereby stopping list exe-
cution.
The initialization function uses five inputs:
•Recognize device - T-F (True-false) input. If true, IDN string is parsed, looking for proper
model (KLR). If false, model is automatically set to KLR for simulation mode.
•Resource string - The VISA resource string, e.g., GPIB::6::INSTR
•ID Query - T-F input. If true, allows the unit to be identified by sending *IDN query. If
false, program enters simulation mode and no commands are actually sent to the power
supply.
•Error in - Described in Table 4-2.
•Reset device - T-F input. If true, sends *RST to unit which turns the output off, sets voltage to zero and current to minimum, and disables execution of a programmed list.
The initialization function provides three outputs:
•Visa Session - a handle defining the connection.
•Model - a string providing the model type for the functions.
•Error out - If the function did not fail, this is a 0.
The first block of Figure 4-6, KepcoDCPWR initialize function, performs the open, creating the
connection between the LabView program and the power supply using the VISA.dll supplied
with LabView. The KepcoDCPWR initialize function has two optional settings: reset unit and
identify unit. The reset unit option sends *RST to the unit which sets the output to 0 volts, minimum current, turns the output off, and stops list execution. The identify unit option sends an
*IDN query to the power supply.
The recognize unit utility function parses the response to determine the proper model number
output. If the identify unit flag is not set, the MODEL OUT of the initialize function reports Standard as the power supply type. The Standard model is a unit that only supports setting voltage,
current and output on/off, and performing measurements; all other functions are bypassed. The
function KepcoDCPWR initialize with options (not used in the example) uses KepcoDCPWR ini-tialize except that Kepco-recommended options are preset: the reset and identify flags set.
All subsequent functions have at least two inputs: VISA session and Model In. VISA session is
the output of viOpen. Model In is a string; for the KLR the string is KLR.
The second block, KepcoDCPWR Query Voltage Limit, is needed to verify the limit model set-
tings. It is recommended that the response from this block be checked to insure that the power
supply is configured to supply the voltage and current needed. For example, if the limit model for
a KLR 75-32 was set to 36 Volts, 32 Amperes, the response will be 36 to this query, indicating
that the program will not respond to a command to set the output to 50 Volts.
KLR-DEV 0607134-7
Page 50
The third subVi is KepcoDCPWR Configure Voltage Mode. This block sets the mode to Fixed. It
is recommended that the mode be set to Fixed in order to stop a list if it is running, however if
the Reset Device input into the first block is true, this block is not needed since *RST also stops
a list.
FIGURE 4-6. SETTING THE OUTPUT, OVERALL BLOCK DIAGRAM
4-8KLR-DEV 060713
Page 51
4.5.2SET THE OUTPUT ON OR OFF
The following three functions are all that are required to set a voltage, current and change the
output state:
•KepcoDCPWR Configure Voltage Level - Sets the voltage output of the power supply
•KepcoDCPWR Configure Current Level - Sets the current output of the power supply
•KepcoDCPWR Configure Output State - Turns the output on
4.5.3GET MEASUREMENT AND STATUS
Three functions are needed to retrieve a measurement (either voltage or current), determine the
output state and determine if there have been any errors.
•KepcoDCPWR Measure [MSR] - Measures the output (voltage in voltage mode, current
in current mode). This function is explained in detail in paragraph 4.4.2.
•KepcoDCPWR Query Output State - Queries the output state and returns 1 for output
on, 0 for output off.
•KepcoDCPWR Error-Query - Retrieves the first error from the error queue. The internal
logic of this subvi changes the “0- no error” response to a null string, so no error returns
nothing, but if an error is detected returns an error string is returned.
4.5.4CLOSE CONNECTION
The last section is the close function, KepcoDCPWR close. This function is required to remove
the connection to the instrument and clean up RAM usage in LabView. It is very important to
release the connections in E-Series models as there are only four connections possible over
VXI-11 (Port 1024) and only two connections possible over SCPI Raw (Port 5025). The Kep-coDCPWR close function releases the connection for other programs to utilize the device.
When the LabView program completes, it must close the driver, however the output is not automatically turned off. Therefore it is recommended that the KepcoDCPWR Configure OutputState function precede the KepcoDCPWR close function. This is not shown in the simplified
example (Figure 4-6), however it is illustrated in the full block diagram showing implementation
of the ramp function, Figure 4-12.
KLR-DEV 0607134-9
Page 52
4.6INTERACTIVE DEMONSTRATION PROGRAM
The interactive demo program allows the user to operate the power supply and provides samples of how to implement the functions.
4.6.1KepcoDCPwr Interactive Example.vi
KepcoDCPwr Interactive Example.vi is the main demonstration program. The file is located in
program files\national Instruments\labview\drivers\kepco. Either double-click on the file or open
the file using File > Open from within LabView. When the program is opened, the Front Panel
(Figure 4-7) is displayed.
FIGURE 4-7. FRONT PANEL WINDOW
4-10KLR-DEV 060713
Page 53
NOTE: When accessed via TCP/IP the four buttons at the bottom of the panel (Software
Ramp, Programmed List, Function Generator and Arbitrary Waveform) are not visible.
Below the logo is the VISA Resource Name field. With the application stopped, click on this field
to display a drop-down menu. Click Refresh causes the LabView program to initiate a new
search and provide an updated list of all devices found on the GPIB, Serial ports and network
connections. You may enter a valid resource name directly or, for demo mode, enter a blank
resource name.
The VOLTAGE and CURRENT knobs are used to set the voltage and current of the power supply. Once the run button is clicked, the VOLTAGE and CURRENT knob markings will show the
limit model minimum and maximum values. The corresponding DC VOLTS and DC AMPERES
displays report the measured voltage and current of the power supply and are updated once
every 250 milliseconds. As the knob rotates, the number in the counter below the knob
changes; if a number is entered in the counter, the knob rotates to the proper position.
If the instrument is found, the demonstration program runs in normal mode. If the instrument is
not found (the Instrument Error box at the lower right shows instrument not found), the
demonstration program runs in simulation mode. In simulation mode the resistance value at the
bottom of the front panel is a simulated load used to measure the DC output. The simulated load
can be set by the user to control the DC VOLTS and DC AMPERES displays.
The POWER SUPPLY MODE switch is used only to select current or voltage mode ramps when
using the Software Ramp button. The indicator to the right of the switch shows whether the unit
is primed to produce voltage ramps ( green) or current ramps (yellow).
The DC OUTPUT switch can be clicked to enable/disable the output. The green indicator within
the switch lights when the output is enabled.
The Set Limits button at the top right is used to set the limit model of the KLR.
The four buttons at the bottom of the front panel invoke standalone functions which can be used
to 1) create a computer-timed software ramp (Software Ramp), 2) create a ramp using the list
functionality (Programmed List), 3) create functions and files for executing complex waveforms
(Function Generator) or 4) create an arbitrary series of points (Arbitrary Waveforms).
KLR-DEV 0607134-11
Page 54
4.6.2SOFTWARE TIMED RAMP EXAMPLE
When the Software Ramp button on the front panel is depressed, the panel shown in Figure 4-8
is displayed. The figure illustrates a current ramp; the voltage ramp panel is similar. The {Power
Supply Mode switch on the front panel (Figure 4-7) determines whether the current ramp or voltage ramp is displayed. It is also possible to run this program by selecting either:
KepcoDCPwr Software Timed Ramp Example.vi for a voltage ramp
KepcoDCPwr Current Software Timed Ramp Example.vi for a current ramp.
FIGURE 4-8. SOFTWARE RAMP PANEL, CURRENT RAMP EXAMPLE
These files are located in the kepco DcPWr folder created when the Kepco LabView G driver is
installed and can be executed by selecting File > Run from within LabView. When invoking
either of these files directly, either a network address or a GPIB address must be set before
clicking Start Ramp (this is automatic when executing Software Ramp via the Front Panel.
4-12KLR-DEV 060713
Page 55
The four boxes labeled Start (beginning of ramp), End (end of ramp), Voltage Increment [or Current Increment] (determines the size of steps, affecting the smoothness of the ramp) and Dwell
(length of time from start to end of ramp) are used to build the ramp. As soon as these values
are entered, the Current [or Voltage] Vs Time Graph shows what the settings will produce when
applied to the output.
The check boxes on the right are effective once the Start Ramp button is clicked.
• Disable @ End. Checked causes the output to turn off when the list is complete.
• # of Cycles. Checked to enter how many ramps will be created; setting of 0 causes ramps to
continue indefinitely. Unchecked to create one ramp.
• Readback Voltage, Readback Current. Once Start Ramp is clicked, checked causes the DC
VOLTS and DC AMPERES indicators on the Ramp Function Panel (see Figure 4-9) to show
measured voltage and current; unchecked causes the indicators to show the commanded values of voltage and current, respectively.
When Start Ramp is clicked, information from the check boxes and # of Cycles is passed to the
example program and used to start ramp execution (see PAR. 4.6.3).
The Error in and Error out boxes are standard error callouts, showing 0 for no error, and an error
code and associated string if there is an error.
KLR-DEV 0607134-13
Page 56
4.6.3SOFTWARE TIMED RAMP EXECUTION
Clicking the Start Ramp button on the Software Ramp panel (Figure 4-8) causes the Ramp
Function Panel (Figure 4-9) to be displayed as the ramp is being generated. Checking the
Readback Voltage or Readback Current checkboxes above the DC VOLTS or DC AMPERES
indicators cause the Voltage and Current indicators to show measured voltage and current
vs.commanded values of voltage and current if unchecked.
FIGURE 4-9. RAMP FUNCTION PANEL, CURRENT RAMP
The information from the Software Ramp Panel is passed to either KepcoDCPwr Software
Timed Ramp Example.vi for a voltage ramp or KepcoDCPwr Current Software Timed Ramp
Example.vi for a current ramp. The computer sends the proper commands to the KLR that gen-
erate the ramp. The checkboxes for Readback Voltage, Readback Current can be altered while
the ramp is being generated to allow the indicators to display either measured or commanded
voltage or current. The Disable @ End and Repeat checkboxes can also be altered while the
ramp is being generated.
The actual function that creates the ramp, a series of points, is shown in Figure 4-12. The logic
for each point is very simple: send the voltage to the unit with the voltage level command, measure the voltage using the Kepco measure vi and do it again for current. A delay is initiated at
the start of the function so the time it takes for the commands to execute does not affect the
overall ramp operation (unless the dwell time is less than 0.01 second on an older PC or about
0.008 second on a higher performance computer).
4-14KLR-DEV 060713
Page 57
4.6.4FUNCTION GENERATOR (Supported in Standalone Configurations Only)
NOTE: Complex, dynamic waveshapes typically require a power supply output that can both
source and sink current, however KLR models without R Option can only source current, and depend on the load to sink current. KLR Models with R Option can sink current for brief periods.
When the Function Generator button on the Front Panel is clicked, the function generator panel
(Figure 4-10) is displayed. The frequency slider determines the frequency of the generated
waveform. The number of points determines the limits for frequency adjustment. For example, if
10 points are selected, the maximum frequency is 100 Hz, the lowest frequency is 0.0015 Hz.
The number of points determines the smoothness of the waveform because it is constructed
incrementally, but it also limits the maximum frequency. For example, if the 250 (maximum)
points are selected, the frequency is 0.00001 Hz.
The Amplitude and Offset sliders are to the right of the Frequency slider. When the requested
output exceeds the capability of the KLR, the output is clipped by the function generator. Below
these sliders is the Waveform Type dropdown selector, either Sine, Sawtooth, Triangle or
Square. Below the Waveform Type dropdown is a visual display of the points that have been
specified. To the left of the displayed waveform is the Duty Cycle slider which affects square
wave-shapes only. The Phase slider shifts the start point of the waveform. As these sliders are
changed, the digital display beneath the slider shows the setting. Changes to the slider settings
immediately change the Commanded Waveform display to reflect the new parameters.
Above the Start button, two additional parameters required for the execution of the waveform
are displayed. The value of the non-changing parameter, current (in Amperes) for a voltage
waveform (shown in Figure 4-13) or voltage (in Volts) for a current waveform must be specified.
The # of Cycles specifies how many waveforms to produce; if set to 0 the waveform repeats
continuously.
Once the Start button is clicked, the commands are sequentially sent to the KLR to build the
waveform by incrementally changing the output. While the waveform is being generated, periodic measurements of the KLR output are made and shown in the Measured Waveform display.
To stop the waveform click on the Stop button, which is red while the waveform is running.
Figure 4-13 is a block diagram that shows how the function generator was implemented using
list commands in this example. The KepcoDCPwr Clear All Lists.vi was executed first. This VI
clears the previous list, allowing the new list to be sent to the KLR. Lists are not deleted from the
KLR except when a limit model setting is changed or when the Clear All function is executed.
The KepcoDCPwr Configure User Sequence.vi does the actual downloading of the points to the
KLR unit. The KepcoDCPwr Configure Voltage Mode.vi causes the list to be executed.
The KepcoDCPwr Configure User Sequence.vi is shown in Figure 4-11. This logic is specifically
configured to generate a voltage list where two arrays of voltage and dwell times are supplied,
along with the operating current and number of cycles for the list to execute. In the left-most
case statement there is a command to send one entry for the control and current lists of the
internal arbitrary waveform generator. The last two functions in the diagram send the dwell and
then the voltage list to the KLR. These functions, along with the individual write of the
LIST:COUN command, set up the arbitrary waveform generator for the selected number of repetitions.
KLR-DEV 0607134-15
Page 58
FIGURE 4-10. FUNCTION GENERATOR PANEL
FIGURE 4-11. CONFIGURE User Sequence.vi BLOCK DIAGRAM
4-16KLR-DEV 060713
Page 59
Page 60
Page 61
E
FIGURE 4-13. FUNCTION G
Page 62
Page 63
SECTION 5 - VXI plug&play DRIVER
5.1INTRODUCTION
The VXI plug&play driver can be used with all KLR models for remote programming.
The driver can be used in a program created by a user with any C compiler to program all ports
accessible via a resource string of the KLR power supply.
5.2VXI PLUG&PLAY INSTRUMENT DRIVER
The VXI plug&play instrument driver provides support for the VXI plug&play environment. This
driver can be downloaded from Kepco’s web site at www.kepcopower.com/drivers/. The driver
includes an executable demonstration program and two files which provide the source code for
the driver and the functional prototypes. In addition, the examples found in this section are also
included with the driver as separate C files.
5.3VXI PLUG&PLAY INSTRUMENT DRIVER FUNCTIONS
Kepco’s KLR VXI plug&play instrument driver provides programming support for Kepco’s KLR
Power Supply via all remote interfaces. It contains functions for opening, configuring, taking
measurements from, testing, calibrating and closing the instrument. To successfully use this
module, the instrument must be connected to the appropriate port using the proper resource
string for the initialize function (see Table 1-1).
The initialize function opens the session, and communicates with the KLR to validate it as a supported model and determines the voltage and current limits of the unit. This driver validates the
model to insure it is the proper driver for the unit. The driver differs from the IVI and LabView G
driver in that it will only operate on a Kepco KLR product and has not support for generic operation or operating other Kepco supplies.
Table 5-1 lists the functions that are available.
TABLE 5-1. KLR VXI PLUG&PLAY DRIVER FUNCTIONS
PurposeFunction NameDescription
INITIALIZE FUNCTION
Initialize UnitKpklr_InitA resource string is passed to this function and the driver is opened.
The handle returned is used in all other functions. This function uses
Kpklr_reset and also performs an *IDN? query to verify the unit is a
Kepco, KLR unit.
ResetKpklr_psResetResets the instrument to a known state and sends initialization com-
mands to the instrument.
CloseKpklr_closeThis function takes the instrument off-line.
SETTING AND MONITORING OUTPUT FUNCTIONS
Set ValueKpklr_SetValueSets the output voltage, the output current of the power supply,
Get ValueKpklr_GetValueGets the output voltage, the output current, voltage protection or cur-
depending on the slide selection position. The values are checked
against the maximum acceptable values for the corresponding power
supply: 0 - voltage, 1 - current, 2 - voltage protection, 3 - current protection
rent protection of the power supply depending on slide selection
position0 - voltage, 1 - current, 2 - voltage protection, 3 - current protection.
Get Relay StatusKpklr_GetRelayStatusGets on/off status of instrument relay.
Set Relay StatusKpklr_SetRelayStatusSets relay on (energized) or off (de-energized) if Relay Mode is set to
Set/reset Front Panel
Lock
Front Panel Lock StatusKpklr_KeybLockStatGets status of front panel lockout
Revision QueryKpklr_RevisionQueryReturns the revision numbers of the instrument driver and instrument
Model QueryKpklr_ModelQueryReturn the model number of the KLR power supply.
Serial Number QueryKpklr_SerialnQueryReturns the serial number of the KLR power supply. The serial num-
Query SCPI VersionKpklr_GetScpiVersionReturns the power supply answer to the Query SCPI Version com-
Self-TestKpklr_selfTestRuns the instrument's self test routine and returns the test result(s).
Error-QueryKpklr_errorQueryReads an error code from the instrument's error queue.
Error MessageKpklr_errorMessageTakes the Status Code returned by the instrument driver functions,
Get System SettingKpklr_SYST_SetGets System Settings
Get Trigger ValueKpklr_GetTrigValueGets the trigger voltage or the trigger current level, depending on the
Set Trigger ValueKpklr_SetTrigValueSets the trigger voltage or trigger current level, depending on the
TriggerKpklr_TrigTriggers the instrument once. The output will go to the trigger voltage
LIMIT MODEL FUNCTIONS
Set Max Voltage/CurrentKpklr_SetMaxLimValueSets limit to maximum voltage/current.
Get Max Voltage/CurrentKpklr_GetMaxLimValueGets maximum voltage/current limit values.
Security CodeKpklr_CalCodeAllows the user to change the password to prevent accidental or
Calibration DumpKpklr_CalDumpInstrument sends calibration data in Intel Hex format.
Kpklr_MeasVoltCurrMeasures the values of output (voltage and current).
1 = Manual, 2 = List Program
Manual (1).
Kpklr_SetResetKeyblockSets or resets front panel controls lockout.
firmware version from the *idn? query. This instrument driver's Revision Number is "Rev 1.0, 9/99, CVI 5.1" and the KLR firmware version
is Firmware Version "1.0". This data is necessary when requesting
technical support.
ber is extracted from the answer to the *idn? query.
mand. Checks the Standard Commands for Programmable Instruments (SCPI) language version.
interprets it and returns it as a user readable string.
switch position.
switch position.
and current values.
unauthorized calibrations of the instrument. The password is stored in
non-volatile memory, and does not change when power has been off
or after a reset. To change the password, the instrument must already
be in calibration status, ensuring that the user knows the current password. If the password is lost, call the factory for support.
Clear ListKpklr_ListClClears the list to prepare for adding points.
Add Volt Step ValueKpklr_ListVoltAdd a single voltage entry to the end of a list.
Add Current Step ValueKpklr_ListCurrent Add a single current entry to the end of a list.
Add Step TimeKpklr_ListDwellAdd a single time entry to the end of a list.
Add relay control step
value
Query How Many PointsKpklr_PointsDetermines the maximum number of points on the list.
Add waveform to a listKpbop_ListDataAdd waveform to a list.
Set list execution cyclesKpklr_ListCountA list can be run from 1- 65535 times. It can also be run continuously
Run/stop LIST programKpklr_ProgRuns or stops LIST program.
LIST Program Run Status Kpklr_Prog_StatStatus of LIST program (running or stopped)
STATUS FUNCTIONS
Set SRQ ConditionKpklr_SetSrqCondSets SRQ Condition Bit.
Display Status MessageKpklr_getDisplayDisplays message in Status Display.
Initialize Status RegistersKpklr_InitRegClears status Operation and Event registers
Get Questionable EventKpklr_StatQuesTests and returns contents of Questionable Event register.
Wait for Operation to
Complete
Wait for SRQKpklr_WaitSrqWaits for SRQ
Kpklr_ListControlAdd a single relay control entry to the end of a list.
if the value is set to 0. The KLR defaults to 1 on a list clear.
Kpklr_WaitOPC~Waits for operation to complete.
5.4USING THE VXI plug&play DRIVER
The example programs are provided to illustrate how to operate the KLR via a remote interface.
The three examples show the following functions:
•Setting Voltage and Current (PAR. 5.4.1)
•Using the Power Supply to Create a Voltage Ramp (PAR. 5.4.2)
•Measurements
5.4.1EXAMPLE 1: SETTING VOLTAGE AND CURRENT
The simple routine shown in Figure 5-1 sets the power supply to a specific value, then leaves it
at this value. It opens the driver, calls the proper functions and then closes the driver. Four possible id_str variable statements have been provided, depending on the interface being used.
The id_str statements for the interfaces not used must be commented out, otherwise errors will
result.
/* Order of the H files is important.
visa.h uses some of the formation functions
kp:KLR.h needs definitions from vias.h to compile correctly
***** end of required h files */
Void main{
/* call function to set power supply to 15 volts at 12 amperes */
Set_powersupply(15,12);
}
/* function Set_powersupply
Sets power supply to the supplied voltage and current.
Also sets the output on as setting to a voltage and current
implies output being placed on */
/* select one of the following ViChar id_str{}strings depending upon port to be used and
comment out the rest */
ViChar id_str{}="GPIB::06::INSTR"; // change 06 to the GPIB address of unit.
/* For LAN ports ( - change 192.168.0.100 to IP address found via front panel interface
*/
ViChar id_str()="TCIP::192.168.0.100::INSTR"; // VXI-11 instrument- via LAN port 1024
ViChar id_str()="TCIP::i92.168.0.100::5025::SOCKET"; // SCPI-RAW port (5025) LAN instrument
/* For RS 232 change 0 to actual communications port in use */
ViChar id_str()="ASRL0::INSTR"; // serial port
if (
(power_supply_status = Kpklr_init ( &id_str, 1, &ps_type, &KLR_Session)) !=Visuccess)
return (power_supply_status); // could not open power supply
/* init the power supply operation
Power supply handle is now created if unit is KLR
************************************/
Kpklr_Set_Volt_Curr (KLR_Session, voltage, current); //voltage and current
/*
The above function sets both the voltage and current setpoint of the power supply
*/
0..._OutputOnOff ( KLR_Session, 1); // output on
Kpklr_close(&KLR_Session); // free up memory and close VISA session
return (power_supply_status);
} // end of main
// if not created as a project, include the driver code at end of program
#include "Kp_klr.c"
FIGURE 5-1. EXAMPLE 1: SETTING VOLTAGE AND CURRENT
5-4KLR-DEV 060713
Page 67
5.4.2EXAMPLE 2: USING THE POWER SUPPLY TO CREATE A VOLTAGE RAMP
A ramp is created by sending a series of points to the power supply at a defined interval. The
example shown in Figure 5-2 initializes the power supply to the starting voltage and current and
turns the output on. The “for” loop provides the actual voltage changes to the power supply once
every 500 milliseconds. The loop uses the set value function to only update the voltage setting
during the loop. This speeds up the process and follows the Kepco’s recommended programming practice of only changing one variable during the loop. The current setting is set for the
worst case output setting of the power supply to insure it remains in voltage mode of operation
and has the cleanest and fastest rise times.
#include <formatio.h>
#include <visa.h>
#include "kp_KLR.h"
/* Order of the H files is important
visa.h uses some of the formation functions
kp:KLR.h needs definitions from visa.h to compile correctly
***** end of required h files */
ViByte ps_type;
ViSession KLR_Session;
void main{
/* these three variables determine the ramp
start voltage, end voltage and rate of change */
ViReal64 voltage_start=0;
ViReal64 voltage_end= 10;
ViReal64 voltage_change=.5;
ViReal64 voltage=0; // used during the ramp startup
ViReal64 current=16; // current during the ramp execution
Unsigned int i;
ViStatus power_supply_status = VI_SUCCESS;
/* select one of the following strings depending upon port to be used */
ViChar id_str{}="GPIB::06::INSTR"; // change 06 to the GPIB address of unit.
/* LAN addresses - change 192.168.0.100 to IP address found via front panel interface
*/
ViChar id_str()="TCIP::192.168.0.100::INSTR"; // VXI-11 instrument- via LAN port 1024
ViChar id_str()="TCIP::i92.168.0.100::5025::SOCKET"; // SCPI-RAW port (5025) LAN instrument
/* change 0 to actual communications port in use */
ViChar id_str()="ASRL0::INSTR"; // serial port
/* init the power supply operation
Power supply handle is now created provided product is KLR
************************************/
return (power_supply_status); // could not open power supply
FIGURE 5-2. EXAMPLE 2: USING THE POWER SUPPLY TO CREATE A VOLTAGE RAMP (SHEET 1 OF 2)
KLR-DEV 0607135-5
Page 68
Kpklr_Set_Volt_Curr (KLR_Session, voltage, current); //voltage and current
/*
The above function sets both the voltage and current setpoint of the power supply
*/
Kpklr_OutputOnOff ( KLR_Session, 1); // output on
for (i=0;i<10;i++){// generates the ramp ten times
Kpklr_SetValue (KLR_Session, voltage_start,0); // set the voltage level only
delay (1000); // wait for unit to return to zero (no load)
} // end of all ramps
Kpklr_OutputOnOff ( KLR_Session, 0); // output off
Kpklr_close( KLR_Session); // free up memory and close VISA session
return (power_supply_status);
} // end of main
// if not created as a project, include the driver code at end of program
#include "Kp_KLR.c"
for (voltage-voltage_start; voltage <=voltage_end; voltage+=voltage_change){
Kpklr_SetValue (KLR_Session, voltage,0); // set the voltage level only
Delay(500); // delay for 500 milliseconds
}
FIGURE 5-2. EXAMPLE 2: USING THE POWER SUPPLY TO CREATE A VOLTAGE RAMP (SHEET 2 OF 2)
5-6KLR-DEV 060713
Page 69
5.4.3EXAMPLE 3: USING THE POWER SUPPLY TO TAKE MEASUREMENTS
Figure 5-3 is an example of using the power supply to take measurements
#include <formatio.h>
#include <visa.h>
#include "kp_KLR.h"
/* Order of the H files in important
visa.h uses some of the formation functions
kp:KLR.h needs definitions from visa.h to compile correctly
***** end of required h files */
/* select one of the following strings depending upon port to be used */
ViChar id_str{}="GPIB::06::INSTR"; // change 06 to the GPIB address of unit.
/* LAN addresses - change 192.168.0.100 to IP address found via front panel interface
*/
ViChar id_str()="TCIP::192.168.0.100::INSTR"; // VXI-11 instrument- via LAN port 1024
ViChar id_str()="TCIP::i92.168.0.100::5025::SOCKET"; // SCPI-RAW port (5025) LAN instrument
/* change 0 to actual communications port in use */
ViChar id_str()="ASRL0::INSTR"; // serial port
ViByte ps_type;
ViSession KLR_Session;
Void main{
ViReal64 meas_volt,meas_curr; // variables for the measurement results
/* call function to set power supply to 15 volts at 12 amperes */
Kpklr_Set_Volt_Curr (KLR_Session, voltage, current); //voltage and current
/*
The above function sets both the voltage and current setpoint of the power supply
*/
Kpklr_OutputOnOff ( KLR_Session, 1); // output on
return (power_supply_status);
} // end of main
// if not created as a project, include the driver code at end of program
#include "Kp_KLR.c"
FIGURE 5-3. EXAMPLE 2: USING THE POWER SUPPLY TO TAKE MEASUREMENTS (SHEET 2 OF 2)
5-8KLR-DEV 060713
Page 71
5.5DEMONSTRATION PROGRAM USING THE VXI PLUG&PLAY DRIVER
The demonstration program is intended to illustrate the use of the VXI plug&play functions
included with the KLR power supply. The demonstration program is installed under Windows by
running SETUP.EXE. The program as written presents a virtual front panel for control of a single
KLR power supply
The following paragraphs describe the windows and the associated controls and indicators provided with the demonstration program. For additional details regarding operation of the KLR,
refer to the operating instructions for local and remote mode found in the KLR User Manual.
5.5.1INSTRUMENT SETUP
NOTE: Please ensure that all programming connections (GPIB or RS 232 as applicable) are in
place before switching the power supply on. Before running the program, verify the
GPIB address and adjust if necessary. For RS 232 communications the power supply
must be set to 38400 baud. Ethernet programming is not supported.
After the program is installed, double clicking KLRCTRL.exe starts the program and opens the
Instrument Setup window (see Figure 5-4). Select the appropriate communications method
(TYPE) from the Instrument Resource list provided. If GPIB is selected, enter the corresponding GPIB address in the box labeled ADDRESS. If RS 232 is selected, enter the number of the
communications port used (e.g., for COM1 enter "1"). Click the CONNECT button to establish
communication with the power supply. If successful, the power supply model number is displayed in the box labeled POWER SUPPLY TYPE FOUND. If not, the Error indicator is red and
an error message is displayed in the box. The most common errors are incorrect GPIB address
or improper baud rate setting (RS 232). If the power supply displayed is correct, click the Continue button to open the main panel (Figure 5-5).
FIGURE 5-4. INSTRUMENT SETUP WINDOW
KLR-DEV 0607135-9
Page 72
5.5.2MAIN PANEL
The main panel window allows remote access to many power supply parameters without having
to operate the local controls and read the corresponding displays, and provides a demonstration
of the programming flexibility of the KLR power supply. The main panel is a real-time display of
output values and programmed parameters.
Various functions accessible via the panel (e.g voltage and current settings, protection limits,
trigger settings, etc.) may be altered either by clicking on the arrows to left of the applicable display or by using the mouse to highlight the setting, typing in a new value and then exiting the
field either by using the Tab key or by clicking the mouse button a second time. Refer to the
indicated paragraphs of the KLR User Manual for programming details.
The analog meters read actual output voltage and current; Two windows beneath the meters
are provided to enter voltage and current setpoints. The Front Panel box shows a digital read-
out of the voltage and current displayed on the analog meters (this is identical to the readouts
on the KLR front panel DC VOLTS and DC AMPERES displays) as well as showing messages
appearing on the front panel Status Display. The operating mode (CV or CC) Mode indicators
light to indicate whether the power supply is operating in either CV (constant voltage) or CC
(constant current) mode.
The Output button applies the programmed settings to the output terminals when set to ON or
keeps the output voltage at zero and current at minimum when set to OFF. When the output is
enabled the button color changes from gray to green.
FIGURE 5-5. MAIN PANEL WINDOW
Set Voltage and Set Current windows are used to program the output voltage and current for
the unit. These settings may be changed by the user (see KLR User Manual, “Setting Voltage or
Current”).
The Protection button opens the Protection Window (Figure 5-6) which displays the present
overvoltage and overcurrent settings; these settings may be changed by the user. These
entries are automatically limited by the Limit Model settings as described in the KLR User Man-
5-10KLR-DEV 060713
Page 73
ual, “Viewing/Changing Overvoltage or Overcurrent Protection Values,” and may affect prior
output settings.
FIGURE 5-6. PROTECTION WINDOW
The Store/Recall button displays the Store/Recall window (Figure 5-7) which can be used to
store or recall up to 40 different power supply settings. After selecting a location, the Store button saves the current power supply settings for Voltage Setpoint, Current Setpoint, and Output
State (On or Off) at the selected location. Whenever the same location is selected, the Recall
button restores the saved settings.
FIGURE 5-7. STORE/RECALL WINDOW
The Trigger button opens the Trigger window (Figure 5-8) which allows setting of trigger voltage
and current values. Clicking the Trigger button within the Trigger window causes the power supply output to be programmed to the settings stored in the Trigger Voltage and Trigger Current
displays.
FIGURE 5-8. TRIGGER WINDOW
KLR-DEV 0607135-11
Page 74
The Calibrate button opens the Calibration Window (Figure 5-9), and is used to recalibrate the
unit (see Section 4 of the KLR User Manual). This button is disabled for master/slave configurations; units must be configured for Standalone to be calibrated.
FIGURE 5-9. CALIBRATION WINDOW
The ABOUT button displays the model, serial number, firmware version number and driver version number. Click OK to close the window
The Limit Model button opens the Limit Model window (Figure 5-10) which displays the present
limit model settings; these limits may be changed by the user. To change these limits the Calibration Password (see KLR User Manual) must be entered. Once either limit is altered, the output is automatically disabled and the previous settings for voltage and current are lost.
FIGURE 5-10. LIMIT MODEL WINDOW
The Front Panel button allows all front panel controls to be locked during remote operation.
When the front panel is locked the button color changes from green to red.
5-12KLR-DEV 060713
Page 75
The Utilities button opens the Utilities window (Figure 5-12).
Calibration Data (hex format) may be archived and restored using the Dump and Restore buttons, respectively. When the Dump button is clicked, the program will prompt the user for a
location and file name for all three calibration locations (see KLR User Manual). The default file
names and locations may be altered by the user. In each case the user may elect not to save
one or more calibration locations by clicking the Cancel button.
FIGURE 5-11. UTILITIES WINDOW
To restore the contents of the Working location to a previously dumped set of values, enter the
calibration password in the box below the Restore button and then click the button. If the correct
password is entered, the program will open a dialog box permitting the user to select from previously saved calibration data sets. Highlight the desired replacement calibration data and click
Select to replace the Working calibration; click Cancel to exit without changing the Working calibration.
The Hardware Test button tests the validity of system parameters (e.g., CRC).
The Output Test button verifies basic performance by first testing maximum voltage output,
then testing minimum voltage output. Note that this test must be performed at no load (open circuit at output power terminals). When Output Test is running, the button changes to Running
(see Figure 5-12.); do not click the button while the test is running.
FIGURE 5-12. UTILITIES WINDOW WITH OUTPUT TEST RUNNING
The Reset button resets the unit to the power up defaults: output voltage set to zero, current set
to minimum current, and output off.
The QUIT button on the Main panel (Figure 5-5) is used to exit the sample VXI plug&play application.
KLR-DEV 0607135-13
Page 76
5.5.3POWER SUPPLY EVENTS
A Source Power Loss error will cause the Power Supply Event Window (Figure 5-13) to open.
This allows the user an opportunity to correct the error condition and continue or quit the VXI
plug&play application. If this window opens when operating a master/slave configuration, power
to both units must be turned off, then reapplied before pressing either of the two buttons, otherwise the VXI plug&play application will terminate incorrectly.
FIGURE 5-13. POWER SUPPLY EVENT WINDOW
5-14KLR-DEV 060713
Page 77
SECTION 6 - PROGRAMMING THE KLR USING SCPI COMMANDS
6.1SCPI PROGRAMMING
SCPI (Standard Commands for Programmable Instruments) is a programming language conforming to the protocols and standards established by IEEE 488.2 (reference document ANSI/IEEE Std 488.2, IEEE Standard Codes, Formats, Protocols, and Common Commands). SCPI commands are sent to the KLR Power Supply as ASCII output strings within the selected programming language (PASCAL, C, BASIC, etc.) in accordance with the manufacturer’s requirements
for the particular GPIB controller card used.
Different programming languages (e.g., BASIC, C, PASCAL, etc.) have different ways of representing data that is to be put on the control bus. It is up to the programmer to determine how to
output the character sequence required for the programming language used. If the IEEE 488.2
(GPIB) control bus is used, address information (GPIB address) must be included before the
command sequence. (See PAR.7.2.1 to establish the KLR Power Supply GPIB address.)
6.2SCPI MESSAGES
There are two kinds of SCPI messages: program messages from controller to power supply,
and response messages from the power supply to the controller. Program messages consist of
one or more properly formatted commands/queries and instruct the power supply to perform an
action; the controller may send a program message at any time. Response messages consist of
formatted data; the data can contain information regarding operating parameters, power supply
state, status, or error conditions.
6.3COMMON COMMANDS/QUERIES
Common commands and queries are defined by the IEEE 488.2 standard to perform overall
power supply functions (such as identification, status, or synchronization) unrelated to specific
power supply operation (such as setting voltage/current). Common commands and queries are
preceded by an asterisk (*) and are defined and explained in Appendix A. Refer also to syntax
considerations (PARs 6.5 through 6.7).
6.4SCPI SUBSYSTEM COMMAND/QUERY STRUCTURE
Subsystem commands/queries are related to specific power supply functions (such as setting
output voltage, current limit, etc.) Figure 6-2 is a tree diagram illustrating the structure of SCPI
subsystem commands used in the KLR Power Supply with the “root” at the left side, and specific
commands forming the branches. The following paragraphs introduce the subsystems; subsystem commands are defined and explained in Appendix B.
6.4.1DISPLAY SUBSYSTEM
This subsystem returns the character string displayed in the Status display.
6.4.2TRIGGER SUBSYSTEM
This subsystem enables the trigger system. When an internal trigger is enabled, the triggering
action will occur upon receipt of a GPIB <GET>, *TRG or TRIGger command. When an external
trigger is enabled, the triggering action occurs when a ground is applied to J2, pin 14. If a trigger
circuit is not enabled, all trigger commands are ignored. Abort sets the trigger subsystem to the
ready-to-arm state.
KLR-DEV 0607136-1
Page 78
6.4.3ABORT SUBSYSTEM
This subsystem cancels any pending trigger levels previously stored and resets them to the
immediate value. ABORt also resets the WTG bit in the Operation Condition register. ABORt is
executed upon initial power-up of the power supply.
6.4.4LIST SUBSYSTEM (Supported in Standalone Configurations Only)
The LIST subsystem is represented by the 250 memory locations (groups of settings) which are
stored in the volatile memory. Each setting contains values for: Current, Voltage, Dwell, and
Relay. The range for the first two values is constrained by the limit model and protection limit
settings. The range for the dwell time is between 0.01 and 655.36 seconds. If the relay is configured to LIST using the UTIL menu on the front panel, it can be set to 1 (on, energized) or 0 (off,
de-energized). Even when the relay is not configured to run a list, LIST:CONT (either 0 or 1)
must be executed once, otherwise the list will not execute.
6.4.5MEASURE SUBSYSTEM
This query subsystem returns the voltage and current measured at the power supply's output
terminals.
6.4.6OUTPUT SUBSYSTEM
This subsystem controls the power supply's output state: on or off.
6.4.7STATUS SUBSYSTEM
This subsystem programs the power supply status register. The power supply has two groups of
status registers: Operation and Questionable. Each group consists of three registers: Condition,
Enable, and Event.
6.4.8STORAGE SUBSYSTEM
The KLR has 40 memory locations where the current state of the power supply can be stored
and then recalled. The storage system saves five settings, Voltage, Current, Voltage protection
level, Current protection level and output on/off state. The advantage to using these 40 locations
instead of sending five commands is processing time. The Saved data is binary data and
requires no processing before applying it to the output, thereby reducing the time needed to
change from one state to another to less a millisecond. The *SAV command saves the five
power supply setting to a location. The *RCL command recalls the fives settings from a location
and applies them it to the power supply output. The MEM:LOC command allows the data to be
loaded into a location without actually programming the KLR. The MEM:LOC? query allows the
five settings to be retrieved prior to applying them to the output, providing a method of verifying
that the settings are correct before applying them to a unit under test.
6.4.9SYSTEM SUBSYSTEM
This subsystem controls the RS 232 port, GPIB address, passwords, security, language, keyboard lockout, and compatibility with older Kepco equipment.
6.4.10[SOURCE:]VOLTAGE AND [SOURCE:]CURRENT SUBSYSTEMS
These subsystems program the output voltage and current of the power supply. An R-Option
(Rapid Output Discharge Circuit installed) unit configured for Standalone operation can generate a voltage or current transient from 0.04 to 655.36 seconds in length.
6-2KLR-DEV 060713
Page 79
6.4.11CALIBRATE SUBSYSTEM
CAL commands and queries are used to perform calibration of the unit via the control interface. These
commands must be issued in a specific sequence in order to properly calibrate the unit. To use these commands, refer to Kepco’s website (www.kepcopower.com/drivers) and download the LabWindows/CVI Version 5 driver for KLR. This file provides remote calibration capability and uses the following supported
commands and queries:
CAUTION: The CAL commands are provide for reference only. Use of these commands in any way, other
than in the supplied remote calibration application, may result in irrecoverable corruption of the
internal calibration files.
SCPI program messages (commands from controller to power supply) consist of one or more
message units ending in a message terminator (required by Kepco power modules). The message
terminator is not part of the syntax; it is defined by the way your programming language indicates the end of a line (“newline” character). The message unit is a keyword consisting of a single command or query word followed by a message terminator (e.g., CURR?<newline> or
TRIG<end-of-line>). The message unit may include a data parameter after the keyword separated by a space; the parameter is usually numeric (e.g., CURR 5<newline>), but may also be a
string (e.g., OUTP ON<newline>). Figure 6-1 illustrates the message structure, showing how
message units are combined. The following subparagraphs explain each component of the
message structure.
NOTE: An alternative to using the message structure for multiple messages defined in the fol-
lowing paragraphs is to send each command as a separate line. In this case each command must use the full syntax shown in Appendix B.
6.5.1KEYWORD
Keywords are instructions recognized by a decoder within the KLR, referred to as a “parser.”
Each keyword describes a command function; all keywords used by the KLR are listed in Figure
6-2.
Each keyword has a long form and a short form. For the long form the word is spelled out completely (e.g. STATUS, OUTPUT, VOLTAGE, and TRIGGER are long form keywords). For the
short form only the first three or four letters of the long form are used (e.g., STAT, VOLT, OUTP,
and TRIG). The rules governing short form keywords are presented in Table 6-1.
You must use the rules above when using keywords. Using an arbitrary short form such as
ENABL for ENAB (ENABLE) or IMME for IMM (IMMEDIATE) will result in an error. Regardless
of which form chosen, you must include all the letters required by that form.
KLR-DEV 0607136-3
Page 80
To identify the short form and long form in this manual, keywords are written in upper case letters to represent the short form, followed by lower case letters indicating the long form (e.g.,
IMMediate, EVENt, and OUTPut). The parser, however, is not sensitive to case (e.g., outp,
OutP, OUTPUt, ouTPut, or OUTp are all valid).
TABLE 6-1. RULES GOVERNING SHORTFORM KEYWORDS
IF NUMBER OF LETTERS IN
LONGFORM KEYWORD IS:
4 OR FEWER(DOES NOT MATTER)ALL LONG FORM LETTERSMODE
5 OR MORE
KEYWORD
ROOT SPECIFIER
MESSAGE UNIT SEPARATOR
DATA
DATA SEPARATOR
KEYWORD
KEYWORD SEPARATOR
AND FOURTH LETTER
IS A VOWEL?
NO
YES
THEN SHORT FORM
CONSISTS OF:
THE FIRST FOUR
LONG FORM LETTERS
THE FIRST THREE
LONG FORM LETTERS
DATA SEPARATOR
DATA
EXAMPLES
MEASure, OUTPut, EVENt
LEVel, IMMediate, ERRor
MESSAGE UNIT SEPARATOR
ROOT SPECIFIER
KEYWORD
QUERY INDICATOR
KEYWORD
MESSAGE TERMINATOR
CURR:LEV 3.5;:OUTP ON;:CURR?<NL>
MESSAGE UNIT
FIGURE 6-1. MESSAGE STRUCTURE
6.5.2KEYWORD SEPARATOR
If a command has two or more keywords, adjacent keywords must be separated by a colon (:)
which acts as the keyword separator (e.g., CURR:LEV:TRIG). The colon can also act as a root
specifier (paragraph 6.5.7).
6-4KLR-DEV 060713
Page 81
6.5.3QUERY INDICATOR
The question mark (?) following a keyword is a query indicator. This changes the command into
a query. If there is more than one keyword in the command, the query indicator follows the last
keyword. (e.g., VOLT? and MEAS:CURR?).
6.5.4DATA
Some commands require data to accompany the keyword either in the form of a numeric value
or character string. Data always follows the last keyword of a command or query (e.g.,
VOLT:LEV:TRIG 14 or SOUR:VOLT? MAX
6.5.5DATA SEPARATOR
Data must be separated from the last keyword by a space (e.g., VOLT:LEV:TRIG 14 or
SOUR:VOLT? MAX
6.5.6MESSAGE UNIT SEPARATOR
When two or more message units are combined in a program message, they must be separated
by a semicolon (;) (e.g., VOLT 15;MEAS:VOLT? and CURR 12; CURR:TRIG 12.5).
6.5.7ROOT SPECIFIER
The root specifier is a colon (:) that precedes the first keyword of a program message. This
places the parser at the root (top left, Figure 6-2) of the command tree. Note the difference
between using the colon as a keyword separator and a root specifier in the following examples:
VOLT:LEV:IMM 16 Both colons are keyword separators.
:CURR:LEV:IMM 4 The first colon is the root specifier, the other two are keyword separators.
VOLT:LEV 6;:CURR:LEV 15 The second colon is the root specifier, the first and third are keyword separators
:INIT ON;:TRIG;:MEAS:CURR?;VOLT? The first three colons are root specifiers.
6.5.8MESSAGE TERMINATOR
The message terminator defines the end of a message. One message terminator is permitted:
•new line (<NL>), ASCII 10 (decimal) or 0A (hex)
NOTE: Kepco power supplies require a message terminator at the end of each program mes-
sage. The examples shown in this manual assume a message terminator will be added
at the end of each message. Where a message terminator is shown it is represented
as <NL> regardless of the actual terminator character.
FIGURE 6-2. TREE DIAGRAM OF SCPI COMMANDS USED WITH KLR POWER SUPPLY
6-6KLR-DEV 060713
Page 83
6.6UNDERSTANDING THE COMMAND STRUCTURE
Understanding the command structure requires an understanding of the subsystem command
tree illustrated in Figure 6-2. The “root” is located at the top left corner of the diagram. The
parser goes to the root if:
•a message terminator is recognized by the parser
•a root specifier is recognized by the parser
Optionalkeywords are enclosed in brackets [ ] for identification; optional keywords can be omitted and the power supply will respond as if they were included in the message. The root level
keyword [SOURce] is an optional keyword. Starting at the root, there are various branches or
paths corresponding to the subsystems. The root keywords for the KLR Power Supply are
:ABORt, :CALibrate, :DISPlay, :LIST, :MEASure, :OUTPut, [:SOURce], :STATus, :STORage,
:SYSTem and :TRIGger. Because the [SOURce] keyword is optional, the parser moves the path
to the next level, so that VOLTage, CURRent, and FUNCtion commands are at the root level.
Each time the parser encounters a keyword separator, the parser moves to the next indented
level of the tree diagram. As an example, the STATus branch is a root level branch that has
three sub-branches: OPERation, PRESet, and QUEStionable. The following illustrates how
SCPI code is interpreted by the parser:
STAT:PRES<NL>
The parser returns to the root due to the message terminator.
STAT:OPER?;PRES<NL>
The parser moves one level in from STAT. The next command is expected at the level defined
by the colon in front of OPER?. Thus you can combine the following message units
STAT:OPER? and STAT:PRES;
STAT:OPER:COND?;ENAB 16<NL>
After the OPER:COND? message unit, the parser moves in one level from OPER, allowing the
abbreviated notation for STAT:OPER:ENAB.
6.7PROGRAM MESSAGE SYNTAX SUMMARY
•Common commands begin with an asterisk (*).
•Queries end with a question mark (?).
•Program messages consist of a root keyword and, in some cases, one or more message
units separated by a colon (:) followed by a message terminator. Several message units
of a program message may be separated by a semicolon (;) without repeating the root
keyword.
•If a program message has more than one message unit, then a colon (:) must precede
the next keyword in order to set the parser back to the root (otherwise the next keyword
will be taken as a subunit of the previous message unit).
e.g., the command meas:volt?;curr? will read output voltage and output current
since both volt? and curr? are interpreted as subunits of the meas command.
KLR-DEV 0607136-7
Page 84
•Several commands may be sent as one message; a line feed terminates the message.
Commands sent together are separated by a semicolon (;). The first command in a message starts at the root, therefor a colon (:) at the beginning is not mandatory.
e.g., the command meas:volt?;:curr? will read output voltage and programmed current since the colon preceding curr? indicates that curr? is not part of the meas command and starts at the root.
•UPPER case letters in mnemonics are mandatory (short form). Lower case letters may
either be omitted, or must be specified completely (long form)
e.g., INSTrument (long form) has the same effect as INST (short form).
•Commands/queries may be given in upper/lower case (long form)
e.g., SoUrCe is allowed.
•Text shown between brackets [ ] is optional.
e.g., :[SOUR:]VOLT:[LEV:]TRIG[:AMPL]? has the same effect as :VOLT:TRIG?
6.7.1EXCEPTIONS TO THE RULES
The volt:lim:high and curr:lim:high commands do not follow the SCPI rules for syntax parsing.
Always send the entire string to insure the commands execute correctly. For example:
VOLT:LIM:HIGH? MIN;:volt:lim:high? max and VOLT:LIM:HIGH?MIN;lim:high? max will
correctly return the min and max voltage limit levels of the power supply. Sending
VOLT:LIM:HIGH? MIN;high? max will not work and will result in an error.
6.8PROGRAMMING EXAMPLES
Figure 6-3 is a programming example that can be used over any interface to measure voltage
and current. Table 6-2 describes the VISA resource string corresponding to the Interface chosen
for communication.
TABLE 6-2. VISA RESOURCE STRING CORRESPONDING TO INTERFACE
INTERFACE
GPIB
SERIAL
LAN-SCPI-RAWTCIP::192.168.0.100::5025::SOCKETThis is the fastest LAN interface, similar to the serial port with
LAN-VXI-11TCIP::192.168.0.100::INSTRThis LAN interface requires a more complex handshake for data
VISA RESOURCE STRINGCOMMENT
GPIB::xx::INSTRThe GPIB address replaces xx.
ASRLy::INSTRThe com port number replaces y.
automatic XON XOFF protocol support.
and is inherently slower than a socket interface. It is similar to the
GPIB interface where you tell the device when to take data and
when it is acceptable to receive data.
6-8KLR-DEV 060713
Page 85
/**************************************************************************/
/* Sample Program For KEPCO power supply, using National Instruments */
/* any interface */
/**************************************************************************/
#include "visa.h"// visa controls and functions
#include <stdio.h>
#include "decl.h"
/* select one of the following strings depending upon port to be used */
ViChar id_str{}="GPIB::06::INSTR"; // change 06 to the GPIB address of unit.
/* LAN addresses - changed the 192.168.0.100 to IP address found via the unit front panel interface */
ViChar id_str()="TCIP::192.168.0.100::INSTR"; // VXI-11 instrument- via LAN port 1024
ViChar id_str()="TCIP::i92.168.0.100::5025::SOCKET"; // SCPI-RAW port (5025) LAN instrument
/* change 0 to actual communications port in use */
ViChar id_str()="ASRL0::INSTR"; // serial port
/* ViOpen uses the resource string to find the device and returns a session id to the user */
ViSession Kepco_Session;
main() {
if (viOpen(Kepco_Session,id_str,VI_NULL,VI_NULL,VI_NULL) == 0){
strcpy(dat_str,"VOLT 5;CURR 1"); // Define a set command
strcat(dat_str,"\r\n"); // Append delimiter - needed for Serial port and
viWrt(Kepco_Session,dat_str); // Send string to power supply
strcpy(dat_str,"MEAS:VOLT?;CURR?"); // Define a measure command
strcat(dat_str,"\r\n"); // Append delimiter
ViWrt(Kepco_Session,dat_str); // Send string to power supply
strset(rd_str,'\0'); // Clear input buffer
ViRd(Kepco_Session,rd_str,64,i); // Read result of measure
printf("received : %s\n",rd_str); // Print voltage and current
viClose(Kepco_Session);// close the instrument
}
// Socket operation
FIGURE 6-3. TYPICAL EXAMPLE OF KLR POWER SUPPLY PROGRAM USING SCPI COMMANDS
KLR-DEV 0607136-9/(6-10 Blank)
Page 86
Page 87
SECTION 7 - IEEE 488.2 (GPIB) INTERFACE
7.1DIGITAL REMOTE MODE PROGRAMMING USING IEEE 488.2 (GPIB) INTERFACE
KLR Power Supplies may be programmed over the IEEE 488 standard communication bus
(General Purpose Interface Bus, GPIB) control bus using SCPI (Standard Commands for Programmable Instruments). SCPI provides a common language conforming to IEEE 488.2 for
instruments used in an automatic test system (see Section 6). Refer to Table 7-1 for GPIB port
input/output signal allocations. All power supply functions available from the front panel can be
programmed via remote commands, as well as some that are not available from the front panel:
Save/Recall (see PAR. 1.2.5), List (see PAR. 1.2.6) and Relay Control (see PARs. B.10 and
B.11).
TABLE 7-1. IEEE 488 PORT CONNECTOR (J4) PIN ASSIGNMENTS
PINSIGNAL NAMEFUNCTION
1
2
3
4
5EOIEnd or Identify
6DAVData Va lid
7NRFDNot Ready for Data
8NDACNot Data Accepted
9IFCInterface Clear
10SRQService Request
11ATNAttention
12SHIELDShield
13
14
15
16
17RENRemote Enable
18GNDGround (signal common)
19GNDGround (signal common)
20GNDGround (signal common)
21GNDGround (signal common)
22GNDGround (signal common)
23GNDGround (signal common)
24LOGIC GNDLogic Ground
I01
D
I02
D
DI03
DI04
I05
D
DI06
DI07
DI08
I/O Line
I/O Line
I/O Line
I/O Line
I/O Line
I/O Line
I/O Line
I/O Line
7.2IEEE 488 (GPIB) BUS PROTOCOL
Table 7-2 defines the interface capabilities of the KLR power supply (Talker/Listener) relative to
the IEEE 488 (GPIB) bus (reference document ANSI/IEEE Std 488: IEEE Standard Digital Interfacefor Programmable Instrumentation) communicating with a Host Computer—Controller (Talker/Listener). Tables 7-3 and 7-4 define the messages sent to the KLR, or received by the KLR, via the
IEEE 488 bus in IEEE 488 command mode and IEEE 488 data mode, respectively. These messages are enabled during the “handshake” cycle, with the KLR power supply operating as either
a Talker or a Listener.
KLR-DEV 0607137-1
Page 88
TABLE 7-2. IEEE 488 (GPIB) BUS INTERFACE FUNCTIONS
FUNCTION
Source HandshakeSH1Complete Capability (Interface can receive multiline messages)
Acceptor HandshakeAH1Complete Capability (Interface can receive multiline messages)
TalkerT6Basic talker, serial poll, unaddress if MLA (My Listen Address) (one-byte address)
ListenerL4Basic listener, unaddress if MTA (My Talk Address) (one-byte address).
Device TriggerDT1Respond to *TRG and <GET> trigger functions.
ControllerC0No Capability
SUBSET
SYMBOL
Complete Capability. The interface sets the SRQ line true if there is an enabled service
request condition.
Complete capability. Interface selects either local or remote information. In local mode the
KLR executes front panel commands, but can be set to remote mode via IEEE 488 bus.
When in Remote mode all front panel keys are disabled except LOCAL. LOCAL key can
be disabled using keypad lockout command (see Appendix B, PAR. B.95) so that only the
controller or a power on condition can restore Local mode.
COMMENTS
TABLE 7-3. IEEE 488 (GPIB) BUS COMMAND MODE MESSAGES
MNEMONIC
DCLDevice ClearReceived
GETGroup Execute TriggerReceived
GTLGo To LocalReceived
IFCInterface ClearReceived
LLOLocal LockoutReceived
MLAMy Listen AddressReceived
MTAMy Talk AddressReceived
OTAOther Talk AddressReceived (Not Used)
RFDReady for DataReceived or Sent
SDCSelected Device ClearReceived
SPDSerial Poll DisableReceived
SPESerial Poll EnableReceived
SRQService RequestSent
UNLUnlistenReceived
MESSAGE
DESCRIPTION
COMMENTS
UNTUntalkReceived
7-2KLR-DEV 060713
Page 89
TABLE 7-4. IEEE 488 (GPIB) BUS DATA MODE MESSAGES
MNEMONICMESSAGE DESCRIPTIONCOMMENTS
DAB
END
EOS
RQS
STB
Data ByteReceived or Sent
EndReceived or Sent
End of StringReceived or Sent
Request ServiceSent
Status ByteSent
7.2.1CHANGING THE GPIB ADDRESS
Use the SYST:COMM:GPIB:ADDR? query to read the current GPIB address. Use the
SYST:COMM:GPIB:ADDR command to change it.
8.1DIGITAL REMOTE MODE PROGRAMMING USING RS 232 [STANDARD MODELS ONLY]
KLR standard models may be programmed over the RS 232 control bus using SCPI (Standard
Commands for Programmable Instruments) (see Section 6). Refer to the KLR User Manual for
RS232 input/output signal allocations. All power supply functions available from the front panel
can be programmed via remote commands, as well as some that are not available from the front
panel: Save/Recall (see PAR. 1.2.5), List (see PAR. 1.2.6) and Relay Control (see PARs. B.10
and B.11).
8.2RS232-C OPERATION [STANDARD MODELS ONLY]
The KLR Power Supply may be operated via an RS232-C terminal, or from a PC using a terminal emulation program. Refer to KLR User Manual for RS 232 connections and default port settings.
All RS 232 parameters may be changed using SCPI commands (see Appendix B) as follows:
•To enable RS 232, refer to PAR’s B.86 and B.87
•For baud rate, refer to PAR’s B.82 and B.83
•For prompt, refer to PAR’s B.90 and B.91;
•For echo, refer to PAR’s B.84 and B.85;
•For XON/XOFF, refer to PAR’s B.88 and B.89.
8.2.1RS 232 IMPLEMENTATION [STANDARD MODELS ONLY]
The following paragraphs are provided to help the user understand how the RS 232 serial interface is implemented in the KLR Power Supply.
The serial interface behaves like the GPIB interface in that the command is parsed after receiving the appropriate control character, in this case either a Line Feed or Carriage Return.
Upon initial application of source power to the KLR input, or after restoration of source power
following an interruption, the power supply will return the identification string described in
Appendix A, PAR. A.6, to the host computer, indicating that the KLR is initialized and ready to
accept programming commands.
Only five control characters (characters between 00
and 1FH) are acknowledged by the power
H
supply:
•Cancel (CAN, 18
•Carriage Return (CR, 0D
•Line Feed (LF, 0A
•Back Space (BS, 08
•Escape (ESC, 01B
, Keyboard command = CTRL+X)
H
, Keyboard command = Enter)
H
, Keyboard command = Enter)
H
, Keyboard command = Backspace)
H
, Keyboard command = ESC)
H
KLR-DEV 0607138-1
Page 92
BS removes the last character in the input buffer queue, with the exception of CR or LF/NL characters. Either the CR or LF (NL) acts as the line terminator, initiating parsing of the ASCII data
sent to the KLR Power Supply by the command originator. When the line is parsed, the KLR
sends a) the line terminator sequence CR LF to the command originator if Prompt is enabled,or
b) the LF character if Echo is enabled and Prompt is off, or c) XON if both Echo and Prompt are
off.
The ESC character is used for synchronization, causing the KLR Power Supply to reset (clear)
its input buffer and return a CR LF sequence. The CAN character operates similarly, except that
both input and output buffers of the KLR Power Supply are reset (cleared). Note that ESC and
CAN characters must be followed by LF for the port to recognize these characters.
Six characters (#, $, !, @, &, %) are not permitted in RS 232 programming strings. These characters are reserved for LAN communications, and their use in other serial programming protocols will likely result in interrupted communications.
8.2.2DATA TRANSFER PROTOCOLS [STANDARD MODELS ONLY]
RS 232 programming can be executed using either manual command/data entry, i.e. computer
keyboard commands, or electronic control (e.g. Labview or LabWindows programming). The
KLR Power Supply offers data transfer protocols tailored for each method.
Since the RS 232 protocol does not use a parity bit, Echo mode is the default method used to
ensure reliable communications between the command originator (computer) and the KLR
Power Supply. When the KLR Power Supply is in the RS 232 echo mode it returns all data
received from the host computer. Echo mode is highly recommended when using the manual
(keyboard) entry method.
The KLR Power Supply provides two additional options that allow handshake-style communication: the prompt method and the XON XOFF method. In the standard implementation of echo
mode the controller must verify that each character sent is echoed back by the KLR. However,
as can be seen in Figure 8-1, there are times when the KLR does not echo back the character
sent from the controller, requiring that the controller resend the character. By using the handshake options (prompt and XON XOFF) the host computer can ensure that the serial data interrupts occurring after parsing of the incoming message do not result in lost data.
Figure 8-1 illustrates the default echo mode, the prompt method and the XON XOFF methods
described in the following paragraphs.
While both echo and prompt modes are very useful when communicating with the instrument
using manual (keyboard) entry, these functions will create problems if implemented with electronic control. For this reason the Kepco drivers for KLR will automatically disable these two
modes as part of initial instrument communications. If the input mode is subsequently changed
back to manual entry, the Echo and Prompt modes are not automatically restored; it is the user's
responsibility to re-enable these features as necessary. By contrast, XON XOFF is compatible
with both manual and electronic input methods, and Kepco strongly recommends that XON
XOFF be enabled for all communications methods.
8.2.2.1ECHO MODE [STANDARD MODELS ONLY]
Echo mode is the default method of ensuring data is transferred without errors. Each byte (character) is echoed back to the sender where it is verified as the same character that was just sent.
If the character is incorrect or missing, the sender sends the character again until the correct
character is verified as having been received.
All non-control characters are sent via the serial port of the command originator. The control
character BS is echoed as BS Space BS. Only the first control character is returned in response
to either a CR LF or LF CR character sequence (see Figure 8-1).
8.2.2.2PROMPT METHOD [STANDARD MODELS ONLY]
The command originator sends a message line (command) to the KLR Power Supply and waits
until the prompt sequence CR LF > is received. The KLR sends the prompt sequence CR LF >
to the command originator indicating the power supply is ready to receive the next command so
that data will not be lost. The prompt method is similar to the echo method described above,
except that the command originator does not have to compare each character and repeat any
characters dropped. The operation of the KLR is identical for echo mode and prompt mode;
implementation of prompt mode is at the command originator.
8.2.2.3XON XOFF METHOD [STANDARD MODELS ONLY]
The XON XOFF method allows the KLR Power Supply to control when the command originator
is allowed to send data. The command originator can only send data after the XON (transmission on) character (011
) has been received; the command originator stops sending data after
H
receiving the XOFF (transmission off) character (013
received before sending additional data.
Control characters, either CR or LF, are returned as XOFF CR if echo mode is on, and as XOFF
if echo mode is off. XOFF stops data from the command originator and the KLR returns the normal sequence of CR LF (if echo mode is enabled).
NOTE: Kepco strongly recommends the XON XOFF method for data transfer via RS 232 pro-
tocol for all Kepco products. If this method is not selected, it is the user's responsibility
to ensure completion of any response by the power supply prior to issuance of subsequent commands.
A Loop Back test can be run from the KLR front panel to aid in isolating RS 232 communications
problems.
1. With the power supply in local mode, if the status display shows SET, tap either the CUR-RENT or VOLTAGE controls to take the unit out of setpoint mode (status display goes from
SET to blank)
2. Use a thin tool (e.g., a paper clip), to press the FUNCTION switch repeatedly until the status
display shows UTIL. Press the DC OUTPUT switch to enter the Utilities menu. Rotate either
the VOLTAGE or CURRENT control until the status display shows LBT (Loop Back Test). At
this point the VOLTS display will show ----.
3. With the power supply's RS 232 port open (no connections), press the DC OUTPUT switch
once to run the test. The VOLTS display should show FAIL; if it reads PASS, the power sup-
ply is defective and requires repair.
4. Install the loop-back test connector (P/N 195-0112) at the RS 232 port, located on the rear
panel of the power supply. (If the loop back test connector is not available, install a jumper
from pin 2 to pin 3 of the RS 232 port connector.) Press the DC OUTPUT switch once to
rerun the test. The VOLTS display should now read PASS; if it reads FAIL, the power supply
is defective and requires repair.
5. To test the integrity of the cable assembly connecting the power supply RS 232 port to the
computer, remove the loop back test connector or jumper and connect the cable in its place.
Install a jumper wire from pin 2 to pin 3 at the opposite end of the cable and repeat the test of
(step 4) above. If the VOLTS display reads FAIL, the cable is either the improper type (not
null modem) or defective. If the VOLTS display reads PASS, the cable is correct. Remove the
jumper and reconnect the cable to the computer.
6. To exit the utilities menu, press the FUNCTION switch repeatedly until the status display is
blank.
If each of the above steps is completed successfully, the problem lies in the computer hardware and/or software. Refer to the Product Support area of the Kepco website for additional
information regarding RS 232 Communications problems: www.kepcopower.com/support.
8-4KLR-DEV 060713
Page 95
SECTION 9 - LAN INTERFACE [E-Series MODELS ONLY]
9.1INTRODUCTION
KLR Power Supplies may be programmed via the LAN interface using the ports illustrated in
Figure 2-1. These ports are described in the following paragraphs.
9.2USING PORT 80 (WEB INTERFACE)
The web interface via port 80 supports up to eight connections to the unit. For details as to how
to access, operate and configure the unit using the web interface, refer to the KLR User Manual.
9.3USING PORT 5024 (TELNET)
To access the unit via Telnet port 5024 the proper command line is TELENET IP ADDRESS
PORT. e.g.:
TELNET 192.168.0.100 5024
NOTE: Port 5025 (SCPI RAW) can also be accessed with the Telnet utility, but the data sent is
not echoed back to the user and there is no prompt string.
The SCPI-TELNET port transfers ASCII SCPI data using the Control M or Control J characters
as line terminators. Table 9-1 lists the Control characters applicable to this port.
TABLE 9-1. TELNET PORT 5024 AND SCPI RAW PORT 5025 CONTROL CHARACTERS
HEX NameKeyFunction
1SOH
2STX
3ETX
5 ENQ
12DC2
14DC4
Ctrl ATerminate connection
Ctrl BExecute Trigger, respond with <TRIGGER>
Ctrl CExecute Device clear to unit respond with <DEVICE CLEAR>
Ctrl J or Ctrl MLine Terminator
Ctrl EUnit will respond with the user description of the device.
Ctrl RLock port
Ctrl TUnlock Port
On receipt of Lock Port, unit verifies other ports (5025 and 1024) are unused and grants the
requesting port exclusive access to control KLR. If port lock is unsuccessful, unit responds with
<DENIED LOCK>. If successful unit responds with <GRANTED LOCK>.
KLR-DEV 0607139-1
Page 96
9.4USING PORT 5025 (SCPI-RAW)
The SCPI-Raw port provides faster access than the VXI-11 port (1024) as it has little overhead.
This port is accessed using the VISA resource string, e.g.:
TCIPO::192.168.1.100::5025:SOCKET
This port can also be accessed via the telnet utility but the data sent is not echoed back to the
user and there is no prompt string.
The SCPI-RAW port transfers ASCII SCPI data using the Control M or Control J characters as
line terminators. Table 9-1 lists the Control characters applicable to this port
On receipt of Lock Port, unit verifies other ports (5024 and 1024) are unused and grants the
requesting port exclusive access to control KLR. If port lock is unsuccessful, unit responds with
<DENIED LOCK>. If successful unit responds with <GRANTED LOCK>.
9.5USING PORT 1024 (VXI-11)
VXI-11 uses one standard port (1024) and two assigned by the instrument when connections
are opened. The 1024 port is open at all times to accept connection requests. The maximum
number of open connections is two. The VXI-11 port requires the use of a lock which prevents
other VXI-11 connections from gaining access to the instrument. This port is accessed using the
VISA resource string ending in INST, e.g.:
TCIP0::192.168.1.100::INST
On receipt of Lock Port, unit verifies other ports (5024 and 5025) are unused and grants the
requesting port exclusive access to control KLR. If port lock is unsuccessful, unit responds with
<DENIED LOCK> If successful unit responds with <GRANTED LOCK>.
9.6USING PORT 5044 ( *TRG COMMAND)
This class C interface supports both multicast trigger events and TCP/IP trigger events. Port
5044 does not support arbitrary names; it supports only domain 1 with a name of LAN0. If this is
sent to the KLR when it is armed and waiting for trigger, the unit will trigger (change the output)
within 2.5 milliseconds of the receipt of this request.
9.7SUNRPC PORT 111
The SUNRPC port is used for discovery when sent as a UDP broadcast message. The only
command supported is the GETPORT. The ports that can be requested are detailed in the VXI
specification and repeated in the LXI specifications.
The SUNRPC port can be also used with the TCP/IP protocol. Again, the only command supported is the GETPORT.
9-2KLR-DEV 060713
Page 97
APPENDIX A - IEEE 488.2 COMMAND/QUERY DEFINITIONS
A.1INTRODUCTION
This appendix defines the IEEE 488.2 commands and queries used with the KLR Power Supply
These commands and queries are preceded by an asterisk (*) and are defined and explained in
PAR. A.2 through A.17, arranged in alphabetical order. Table A-1 provides a quick reference of all
IEEE 488.2 commands and queries supported in the KLR Power Supply.
COMMANDPAR.COMMANDPAR.
*CLSA.2*RSTA.13
*ESE, ?A.3, A.4*SAVA.13
*ESR?A.5*SRE, ?A.13, A.14
*IDN?A.6*STB?A.15
*OPC, ?A.7, A.8*TRGA.16
*OPT?A.13*TST?A.17
*RCLA.13*WAIA.18
TABLE A-1. IEEE 488.2 COMMAND/QUERY INDEX
A.2*CLS — CLEAR STATUS COMMAND
*CLS
Syntax:*CLS
Description: Clears status data. Clears the following registers without affecting the corresponding Enable Regis-
ters: Standard Event Status Register (ESR), Operation Status Event Register, Questionable Status
Event Register, and Status Byte Register (STB). Also clears the Error Queue. Related commands:
*OPC, *OPC?. (See example, Figure A-1.)
A.3*ESE — STANDARD EVENT STATUS ENABLE COMMAND *ESE
Syntax:*ESE <integer> where <integer> = positive whole number: 0 to 255 per Table A-2.
Default Value: 0
Description: This command programs the standard Event Status Enable register bits. The contents function
as a mask to determine which events of the Event Status Register (ESR) are allowed to set the ESB
(Event Summary Bit) of the Status Byte Register. Enables the Standard events to be summarized in
the Status Byte register (1 = set = enable function, 0 = reset = disable function). All of the enabled
events of the standard Event Status Enable register are logically ORed to cause ESB (bit 5) of the Status Byte Register to be set (1 = set = enable, 0 = reset = disable)
A.4*ESE? — STANDARD EVENT STATUS ENABLE QUERY *ESE?
Syntax:*ESE? Return value: Integer> value per Table A-2.
Description: Returns the mask stored in the Standard Event Status Enable Register. Contents of Standard
Event Status Enable register (*ESE) determine which bits of Standard Event Status register (*ESR)
are enabled, allowing them to be summarized in the Status Byte register (*STB). All of the enabled
events of the Standard Event Status Enable Register are logically ORed to cause ESB (bit 5) of the
Status Byte Register to be set (1 = set = enable function, 0 = reset = disable function). (See example,
Figure A-1.)
A.5*ESR? — EVENT STATUS REGISTER QUERY *ESR?
Syntax:*ESR?
Return value: <integer> (Value = contents of Event Status register as defined in Table A-2.)
Description: Causes the power supply to return the contents of the Standard Event Status register. After it
has been read, the register is cleared. The Standard Event Status register bit configuration is
defined in Table A-2 (1 = set, 0 = reset). The error bits listed in Table A-2 are also related to error
codes produced during parsing of messages and to errors in the power supply (see PAR. B.92 and
Table B-5)
•Any 1xx type error sets the Command error bit (5).
•Any 2xx type error sets the Execution error bit (4).
•Any 3xx type error sets the Device error bit (3). The Device error bit will be set when Current Error
or Voltage Error is detected and the corresponding Status Questionable Enable bit is set.
•Any 4xx type error sets the Query error bit (2).
Related Commands: *CLS, *ESE, *OPC. (See example, Figure A-1.)
A.6*IDN? — IDENTIFICATION QUERY *IDN?
Syntax:*IDN?
Return value: Character string
Description: Identifies the instrument. This query requests identification. The power supply returns a string
which contains the manufacturer name, model, option(s) installed, serial number and firmware version.
The character string for standard models contains the following fields:
<Manufacturer>,<Model>-1200,<Last Calibration Date>,<Serial Number>,<Firmware revision>
The character string for two standard models in series contains the following fields:
<Manufacturer>,<Model _S> Series <Manufacturing Date master unit>,<Serial Number of master
unit>,<Firmware revision>
The character string for two standard models in parallel contains the following fields:
<Manufacturer>,<Model_P> Parallel <Manufacturing Date master unit>,<Serial Number of master
unit>,<Firmware revision>
The character string for standard models with R option (RODC) contains the following fields:
<Manufacturer>,<Model> RODC,<Last Calibration Date>,<Serial Number>,<Firmware revision>
The character string for E-Series models contains the following fields:
<Manufacturer>,<Model> LAN,<Last Calibration Date>,<Serial Number>,<Firmware revision>-<LAN
Firmware revision>
A-2KLR-DEV 060713
Page 99
The character string for E-Series models with RODC contains the following fields:
<Manufacturer>,<Model> LAN RODC,<Last Calibration Date>,<Serial Number>,<Firmware revision><LAN Firmware revision>
where:
•<Manufacturer> = KEPCO
•<Model> = KLR V-C (V is E
<Model_S> = KLR (2V-C (2V is E
<Model_P> = KLR V-2C (V is E
oMAX
, C is I
oMAX
oMAX
oMAX
x 2, C is I
, 2C is I
oMAX
oMAX
x 2
•LAN = E-Series model (ethernet-enabled with LAN port conforming to LXI protocols
•<Manufacturing Data> = DDMMYYYY-Axxxxxx (DD=day, MM=month, and YYYY=year of manufacture, Axxxxxx=unit serial number)
•<Firmware revision> = Vn.m (original factory firmware) or vn.m (updated or secondary firmware)
(n.m revision, e.g, V1.01 or v4.00)
•<LAN Firmware revision> [E-Series models only] = Vn.m (original factory LAN firmware) or vn.m
(updated or secondary LAN firmware) (n.m revision, e.g, V1.01 or v4.00)
(See example, Figure A-1.)
A.7*OPC — OPERATION COMPLETE COMMAND *OPC
Syntax:*OPC
Description: Causes power supply to set status bit 0 (Operation Complete) when pending operations are
complete. This command sets Standard Event Status Register bit 0 (see Table A-2) to “1” when all
previous commands have been executed and changes in output level have been completed. This
command does not prevent processing of subsequent commands, but bit 0 will not be set until all
pending operations are completed. (1 = set = enable function, 0 = reset = disable function). (See
example, Figure A-1.) As an example, the controller sends command(s), then sends *OPC. If controller then sends *ESR?, the power supply responds with either a “0” (if the power supply is busy executing the programmed commands), or a “1” (if the previously programmed commands are complete).
(See example, Figure A-1.)
A.8*OPC? — OPERATION COMPLETE QUERY *OPC?
Syntax:*OPC?
Return value: <1> (ASCII) placed in output queue when power supply has completed operation.
Description: Indicates when pending operations have been completed.When all pending operations are com-
plete (all previous commands have been executed and changes in output level have been completed)
a “1” is placed in the Output Queue. Subsequent commands are inhibited until the pending operations
are completed. *OPC? is intended to be used at the end of a command line so that the application program can monitor the bus for data until it receives the “1” from the power supply Output Queue. (See
example, Figure A-1.)
KLR-DEV 060713A-3
Page 100
A.9*OPT? — OPERATION COMPLETE QUERY *OPT?
Syntax:*OPT?
Return value: option string which is a comma separated list
250 LST,.01 TMIN,655.36 TMAX,3 RL,40 MEM,4 DSM,CCAL
where:
xxx LST indicates maximum number of points supported by list
yyy TMIN indicates minimum list dwell time in seconds
zzzzzz TMAX indicates maximum list dwell time in seconds
3 RL indicates keyboard lockout supported
aa MEM indicates number (aa) of save and recall memory locations
b DSM indicates number (b) of characters in front panel display
CCAL indicates calibration can be performed without manually adjusted pots.
Description: Lists configuration parameters in format compatible with LabView and C routines. Configura-
tion parameters include List settings (number of points, minimum dwell time, maximum dwell time),
whether keyboard lockout is supported, number of save and recall locations, and whether calibration
is performed without mechanical pots. For example 250 LST,.01 TMIN,655.36 TMAX,3 RL,40 MEM,4
DSM,CCAL means the unit supports up to 250 points in a list, minimum list dwell time is 0.01 seconds,
maximum list dwell time is 655.36 seconds, keyboard lockout is supported, 40 memory locations available for Save and Recall, the front panel has a four-character display, and calibration does not require
manually adjusted pots.
A.10 *RCL — RECALL COMMAND *RCL
Syntax:*RCL<integer> (1 to 40)
Description: Restores power supply to previously defined levels of output voltage, output current, overvolt-
age protection, overcurrent protection, output state (on or off) and relay state. Executing *RCL
recalls the settings previously saved by *SAV from one of 40 memory locations, changing the voltage,
current, overvoltage protection, overcurrent protection, and output on/off state accordingly. If RELAY
mode was set to MANUAL when *SAV was executed, relay state is also restored; relay state is not
saved upon power off. The following parameters are affected by *RCL: VOLT, CURR, VOLT:PROT,
CURR:PROT, and OUTP.
A.11 *RST — RESET COMMAND *RST
Syntax:*RST
Description: Resets power supply to the power on default state. The power supply is programmed to the power
on values of the following parameters: CURR[:LEV][:IMM] = MIN (minimum), VOLT[:LEV][:IMM] = 0,
OUTP[:STAT] = 0 (OFF). In addition, *RST sets INIT:CONT to OFF, sets VOLT:MODE to FIXED, stops
all LIST or TRAN operations. (See example, Figure A-1.)
A.12 *SAV — SAVE COMMAND *SAV
Syntax:*SAV<integer> (1 to 40)
Description: Saves the present state of output voltage, output current, overvoltage protection, overcurrent
protection, and output state on/off and (if RELAY mode is set to MANUAL) relay state to the
specified memory location. This command stores the present state of the power supply to one of 40
memory locations in non-volatile Memory. If RELAY mode is set to MANUAL from the front panel UTIL
menu, relay state, on or off, is also saved. The following parameters are stored by *SAV: VOLT,
CURR, OUTP, and VOLT:PROT, CURR:PROT. The stored values can be restored by the *RCL command.NOTE: If a Limit Model setting is changed, previously stored settings may be outside the range
established by the new limit model. In this case, when *RCL is executed, the value is cleared to the
default minimum (0V, minimum A) and an “out of range” error message is generated.
A-4KLR-DEV 060713
Loading...
+ 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.