KEPCO KLR User Manual

Page 1
DEVELOPER’S GUIDE
KLR SERIES
POWER SUPPLY
2400 WATT PROGRAMMABLE POWER SUPPLY
An ISO 9001 Company.
KLR SERIES
DEVELOPER’S GUIDE
ORDER NO. REV. NO.
IMPORTANT NOTES:
1) This manual is valid for the following Model and associated serial numbers:
FIRMWARE VERSION NOTE
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 num­bers. 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 Docu­mentation 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.
Data subject to change without notice.
MODEL
©2013, KEPCO, INC P/N 243-1298
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
SECTION PAGE

SECTION 1 - INTRODUCTION

1.1 General Description .................................................................................................................................... 1-1
1.1.1 Drivers ..................................................................................................................................................... 1-1
1.1.2 Communication ....................................................................................................................................... 1-2
1.1.3 Programming........................................................................................................................................... 1-2
1.2 Driver Overview .......................................................................................................................................... 1-2
1.2.1 Initialization.............................................................................................................................................. 1-3
1.2.2 Output Control ......................................................................................................................................... 1-3
1.2.3 Measurement .......................................................................................................................................... 1-3
1.2.4 Limit Models (User-defined Voltage/Current Limits)................................................................................ 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
1.2.7.6 Error/Event Queue ............................................................................................................................. 1-8
1.2.8 Trigger ..................................................................................................................................................... 1-8

SECTION 2 - COMMUNICATION

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

SECTION 3 - IVI-COM DRIVER

3.1.1 Specification Compliance ........................................................................................................................ 3-1
3.1.2 Range Checking and Coercion ............................................................................................................... 3-1
3.1.3 Multithreading Support ............................................................................................................................ 3-1
3.1.4 Context-Sensitive Help............................................................................................................................ 3-2
3.1.5 Installer.................................................................................................................................................... 3-2
3.1.6 Rights ...................................................................................................................................................... 3-2
3.2 IVI-COM Instrument Driver Functions......................................................................................................... 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.3.3 Setting Limit Model.................................................................................................................................. 3-11
3.4 Examples Using Visual Basic ..................................................................................................................... 3-12
3.4.1 Setting the Output to a Value and Taking a Measurement ..................................................................... 3-12
3.4.2 Using a List to Perform a Series of Operations ....................................................................................... 3-15
3.4.3 Setting Limit Model.................................................................................................................................. 3-16
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.4.1 K
4.4.1.1 Connector Panel ................................................................................................................................ 4-3
4.4.1.2 Controls and Indicators ...................................................................................................................... 4-3
4.4.1.3 Block Diagram Description................................................................................................................. 4-4
4.4.2 K
KLR DEVGD 020498 i
epcoDCPwr Configure Voltage Level.vi ........................................................................................ 4-3
epcoDCPwr Measure [MSR].vi ..................................................................................................... 4-5
Page 4
TABLE OF CONTENTS
SECTION PAGE
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.1 KepcoDCPwr Interactive Example.vi...................................................................................................... 4-10
4.6.2 Software timed ramp example................................................................................................................ 4-12
4.6.3 Software Timed Ramp Execution ........................................................................................................... 4-14
4.6.4 Function Generator................................................................................................................................. 4-15

SECTION 5 - VXI plug&play DRIVER

5.2 VXI plug&play Instrument Driver................................................................................................................ 5-1
5.3 VXI plug&play Instrument Driver Functions ............................................................................................... 5-1
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.1 Instrument Setup .................................................................................................................................... 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.2 SCPI Messages ......................................................................................................................................... 6-1
6.3 Common Commands/Queries ................................................................................................................... 6-1
6.4 SCPI Subsystem Command/Query Structure............................................................................................ 6-1
6.4.1 DISPlay Subsystem................................................................................................................................ 6-1
6.4.2 TRIGger Subsystem ............................................................................................................................... 6-1
6.4.3 Abort Subsystem .................................................................................................................................... 6-2
6.4.4 LIST Subsystem ..................................................................................................................................... 6-2
6.4.5 MEASure Subsystem.............................................................................................................................. 6-2
6.4.6 OUTPut Subsystem................................................................................................................................ 6-2
6.4.7 STATus Subsystem................................................................................................................................ 6-2
6.4.8 STorage Subsystem ............................................................................................................................... 6-2
6.4.9 SYSTem subsystem ............................................................................................................................... 6-2
6.4.10 [SOURce:]VOLTage and [SOURce:]CURRent Subsystems .................................................................. 6-2
6.4.11 CALibrate Subsystem............................................................................................................................. 6-3
6.5 Program Message Structure ...................................................................................................................... 6-3
6.5.1 Keyword.................................................................................................................................................. 6-3
6.5.2 Keyword Separator................................................................................................................................. 6-4
6.5.3 Query Indicator ....................................................................................................................................... 6-5
6.5.4 Data ........................................................................................................................................................ 6-5
6.5.5 Data Separator ....................................................................................................................................... 6-5
6.5.6 Message Unit Separator......................................................................................................................... 6-5
6.5.7 Root Specifier ......................................................................................................................................... 6-5
6.5.8 Message Terminator............................................................................................................................... 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
6.8 Programming Examples............................................................................................................................. 6-8
ii KLR DEVGD 060713
Page 5
TABLE OF CONTENTS
SECTION PAGE

SECTION 7 - IEEE 488.2 (GPIB) INTERFACE

7.2 IEEE 488 (GPIB) Bus Protocol ................................................................................................................... 7-1
7.2.1 Changing the GPIB Address ................................................................................................................... 7-3

SECTION 8 - RS 232C INTERFACE [STANDARD MODELS ONLY]

8.2 RS232-C Operation [Standard Models Only].............................................................................................. 8-1
8.2.1 RS 232 Implementation [Standard Models Only] .................................................................................... 8-1
8.2.2 Data Transfer Protocols [Standard Models Only].................................................................................... 8-2
8.2.2.1 Echo Mode [Standard Models Only] .................................................................................................. 8-3
8.2.2.2 Prompt Method [Standard Models Only] ............................................................................................ 8-3
8.2.2.3 XON XOFF Method [Standard Models Only] ..................................................................................... 8-3
8.2.2.4 Isolating RS 232 Communications Problems [Standard Models Only] .............................................. 8-4

SECTION 9 - LAN INTERFACE [E-Series MODELS ONLY]

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
A.6 *IDN? — Identification Query..................................................................................................................... A-2
A.7 *OPC — Operation Complete Command .................................................................................................. A-3
A.8 *OPC? — Operation Complete Query....................................................................................................... A-3
A.9 *OPT? — Operation Complete Query ....................................................................................................... A-4
A.10 *RCL — Recall Command ......................................................................................................................... A-4
A.11 *RST — Reset Command.......................................................................................................................... A-4
A.12 *SAV — Save Command........................................................................................................................... A-4
A.13 *SRE — Service Request Enable Command ............................................................................................ A-5
A.14 *SRE? — Service Request Enable Query ................................................................................................. A-6
A.15 *STB? — Status Byte Register Query ....................................................................................................... A-6
A.16 *TRG — Trigger Command ....................................................................................................................... A-6
A.17 *TST? — Self Test Query .......................................................................................................................... A-6
A.18 *WAI — Wait Command ............................................................................................................................ A-6

APPENDIX B - SCPI COMMAND/QUERY DEFINITIONS

B.1 Introduction................................................................................................................................................ B-1
B.2 Numerical Values....................................................................................................................................... B-2
B.3 ABOR B.4 CAL B.5 DISP
B.6 INITiate[:IMMediate] Command................................................................................................................ B-2
B.7 INIT
B.8 INITiate:CONTinuous Query ..................................................................................................................... B-4
B.9 [SOUR B.10 [SOUR
B.11 [SOURce:]LIST:CONTrol? QUERY........................................................................................................... B-4
B.12 [SOUR
t Command...................................................................................................................................... B-2
ibrate Commands and Queries .......................................................................................................... B-2
lay[:Window]:TEXT[:DATA]? Query.................................................................................................. B-2
iate:CONTinuous Command .............................................................................................................. B-3
ce:]LIST:CLEar Command............................................................................................................. B-4
ce:]LIST:CONTrol Command......................................................................................................... B-4
ce:]LIST:CONtrol:POINts? Query.................................................................................................. B-4
KLR DEVGD 020498 iii
Page 6
TABLE OF CONTENTS
SECTION PAGE
B.13 [SOURce:]LIST:COUNt Command............................................................................................................ B-4
B.14 [SOURce:]LIST:COUNt? Query................................................................................................................. B-4
B.15 [SOURce:]LIST:COUNt:SKIP Command................................................................................................... B-4
B.16 [SOUR
B.17 [SOURce:]LIST:CURRent Command........................................................................................................ B-5
B.18 [SOURce:]LIST:CURRent? Query............................................................................................................. B-5
B.19 [SOUR
B.20 [SOURce:]LIST:DIRection Command ....................................................................................................... B-5
B.21 [SOUR
B.22 [SOURce:]LIST:DWELl Command ............................................................................................................ B-5
B.23 [SOURce:]LIST:DWELl? Query................................................................................................................. B-6
B.24 [SOUR
B.25 [SOURce:]LIST:QUERy Command ........................................................................................................... B-6
B.26 [SOURce:]LIST:QUERy? Query................................................................................................................ B-6
B.27 [SOUR
B.28 [SOURce:]LIST:VOLTage? Query ............................................................................................................. B-6
B.29 [SOURce:]LIST:VOLTage:POINts? Query ................................................................................................ B-7
B.30 MEAS
B.31 MEASure[:SCALar]:VOLTage[:DC]? Query .............................................................................................. B-7
B.32 MEMory:LOCation Command ................................................................................................................... B-7
B.33 MEM
B.34 OUTPut[:STATe] Command ...................................................................................................................... B-8
B.35 OUTPut[:STATe]? Query ........................................................................................................................... B-9
B.36 [SOUR
B.37 [SOURce:]CURRent[:LEVel][:IMMediate][:AMPlitude]? Query ................................................................ B-9
B.38 [SOURce:]CURRent:LIMit:HIGH Command ............................................................................................. B-9
B.39 [SOUR
B.40 [SOURce:]CURRent:MODE Command..................................................................................................... B-10
B.41 [SOURce:]CURRent:MODE? Query ......................................................................................................... B-10
B.42 [SOUR
B.43 [SOURce:]CURRent:PROTection[:LEVel]? Query.................................................................................... B-12
B.44 [SOURce:]CURRent:[:LEVel]TRIGgered[:AMPLitude] Command............................................................ B-12
B.45 [SOUR
B.46 [SOURce:]FUNCtion:MODE Command .................................................................................................... B-12
B.47 [SOURce:]FUNCtion:MODE? Query......................................................................................................... B-12
B.48 [SOUR B.49 [SOUR B.50 [SOUR B.51 [SOUR
B.52 [SOURce:]VOLTage:MODE Command..................................................................................................... B-14
B.53 [SOURce:]VOLTage:MODE? Query.......................................................................................................... B-14
B.54 [SOUR
B.55 [SOURce:]VOLTage:PROTection[:LEVel]? Query .................................................................................... B-14
B.56 [SOURce:]VOLTage:[LEVel:]TRIGgered[:AMPLitude] Command ............................................................ B-15
B.57 [SOUR
B.58 STATus:OPERation:CONDition? Query ................................................................................................... B-16
B.59 STAT B.60 STAT
B.61 STATus:OPERation[:EVENt]? Query........................................................................................................ B-16
B.62 STAT B.63 STAT
B.64 STATus:QUEStionable:CONDition? Query .............................................................................................. B-18
B.65 STAT
B.66 STATus:QUEStionable:ENABle? Query ................................................................................................... B-18
B.67 SYST B.68 SYST
B.69 SYSTem:COMMunication:LAN:AUTO Command..................................................................................... B-18
B.70 SYST
ce:]LIST:COUNt:SKIP? Query ....................................................................................................... B-5
ce:]LIST:CURRent:POINts? Query................................................................................................ B-5
ce:]LIST:DIRection? Query............................................................................................................ B-5
ce:]LIST:DWELl:POINts? Query .................................................................................................... B-6
ce:]LIST:VOLTage Command ........................................................................................................ B-6
ure[:SCALar]:CURRent[:DC]? Query.............................................................................................. B-7
ory:LOCation? Query........................................................................................................................ B-7
ce:]CURRent[:LEVel][:IMMediate][:AMPlitude] Command............................................................ B-9
ce:]CURRent:LIMit:HIGH? Query .................................................................................................. B-10
ce:]CURRent:PROTection[:LEVel] Command ............................................................................... B-11
ce:]CURRent:[:LEVel]TRIGgered[:AMPlitude]? Query.................................................................. B-12
ce:]VOLTage[:LEVel][:IMMediate][:AMPLitude] Command ........................................................... B-12
ce:]VOLTage[:LEVel][:IMMediate][:AMPLitude]? Query................................................................ B-13
ce:]VOLTage:LIMit:HIGH Command.............................................................................................. B-13
ce:]VOLTage:LIMit:HIGH? Query................................................................................................... B-13
ce:]VOLTage:PROTection[:LEVel] Command................................................................................ B-14
ce:]VOLTage:[:LEVel]TRIGgered[:AMPLitude]? Query................................................................. B-15
us:OPERation:ENABle Command ................................................................................................... B-16
us:OPERation:ENABle? Query ........................................................................................................ B-16
us:PRESet Command ...................................................................................................................... B-16
us:QUEStionable[:EVENt]? Query................................................................................................... B-17
us:QUEStionable:ENABle Command .............................................................................................. B-18
em:COMMunication:GPIB:ADDRess Command............................................................................. B-18
em:COMMunication:GPIB:ADDRess? Query.................................................................................. B-18
em:COMMunication:LAN:AUTO? Query ......................................................................................... B-19
iv KLR DEVGD 060713
Page 7
TABLE OF CONTENTS
SECTION PAGE
B.71 SYSTem:COMMunication:LAN:DHCP Command .................................................................................... B-19
B.72 SYSTem:COMMunication:LAN:DHCP? Query ......................................................................................... B-19
B.73 SYSTem:COMMunication:LAN:DNS Command....................................................................................... B-19
B.74 SYST
B.75 SYSTem:COMMunication:LAN:GATE Command..................................................................................... B-19
B.76 SYSTem:COMMunication:LAN:GATE? Query ......................................................................................... B-19
B.77 SYST
B.78 SYSTem:COMMunication:LAN:IP? Query................................................................................................ B-20
B.79 SYST
B.80 SYSTem:COMMunication:LAN:MASK Command .................................................................................... B-20
B.81 SYSTem:COMMunication:LAN:MASK? Query ......................................................................................... B-20
B.82 SYST
B.83 SYSTem:COMMunication:SERial:BAUD? Query ..................................................................................... B-20
B.84 SYSTem:COMMunication:SERial:ECHO Command................................................................................ B-21
B.85 SYST
B.86 SYSTem:COMMunication:SERial:ENABle Command ............................................................................. B-21
B.87 SYSTem:COMMunication:SERial:ENABle? Query .................................................................................. B-21
B.88 SYST
B.89 SYSTem:COMMunication:SERial:PACE? Query ..................................................................................... B-21
B.90 SYSTem:COMMunication:SERial:PROMpt Command ............................................................................ B-21
B.91 SYST
B.92 SYSTem:ERRor[:NEXT]? Query ............................................................................................................... B-22
B.93 SYSTem:ERRor:CODE[:NEXT]? Query.................................................................................................... B-22
B.94 SYST
B.95 SYSTem:KLOCk Command ...................................................................................................................... B-22
B.96 SYSTem:KLOCk? Query ........................................................................................................................... B-23
B.97 SYST
B.98 SYSTem:LANGuage? Query .................................................................................................................... B-23
B.99 SYSTem:PASSword:CENable Command ................................................................................................ B-24
B.100 SYST
B.101 SYSTem:PASSword:NEW Command....................................................................................................... B-24
B.102 SYSTem:PASSword[:CENable]:STATe? Query ....................................................................................... B-24
B.103 SYST
B.104 SYSTem:SET Command ........................................................................................................................... B-24
B.105 SYSTem:SET? Query................................................................................................................................ B-25
B.106 SYST B.107 TRIG B.108 TRIG
em:COMMunication:LAN:DNS? Query............................................................................................ B-19
em:COMMunication:LAN:IP Command........................................................................................... B-20
em:COMMunication:LAN:MAC? Query ........................................................................................... B-20
em:COMMunication:SERial:BAUD CommanD................................................................................ B-20
em:COMMunication:SERial:ECHO? Query..................................................................................... B-21
em:COMMunication:SERial:PACE Command ................................................................................ B-21
em:COMMunication:SERial:PROMpt? Query................................................................................. B-22
em:ERRor:CODE:ALL? Query......................................................................................................... B-22
em:LANGuage Command................................................................................................................ B-23
em:PASSword:CDISable Command ............................................................................................... B-24
em:SECurity:IMMediate Command................................................................................................. B-24
em:VERSion? Query........................................................................................................................ B-25
ger[:SEQuence]:SOURce Command............................................................................................... B-25
ger[:SEQuence]:SOURce? Query ................................................................................................... B-25
KLR DEVGD 020498 v
Page 8
LIST OF FIGURES
FIGURE TITLE PAGE
1-1 Status Reporting Structure......................................................................................................................... 1-5
2-1 KLR Communication, Block Diagram ......................................................................................................... 2-1
3-1 Example of Setting the Output and taking a measurement, written in C++................................................ 3-6
3-2 Example of Using a List, written in C#........................................................................................................ 3-9
3-3 Setting the Output and taking a measurement Example, written in Visual Basic ....................................... 3-14
3-4 Example of Using a List, written in Visual Basic......................................................................................... 3-15
3-5 Setting Limit Model, Written in Visual Basic ............................................................................................... 3-17
3-6 Setting the Output Using LabView with IVI-COM Driver ............................................................................ 3-18
3-7 Measuring Voltage and Current Using LabView with IVI-COM Driver ....................................................... 3-19
3-8 Setting the Limit Model Using LabView with IVI-COM Driver..................................................................... 3-19
4-1 KepcoDCPwr Configure Voltage Level.vi Connector Panel ....................................................................... 4-3
4-2 KepcoDCPwr Configure Voltage Level.vi Block Diagram .......................................................................... 4-5
4-3 KepcoDCPwr Configure Voltage Level.vi Error Block Diagram ................................................................. 4-5
4-4 KepcoDCPwr Measure [MSR].vi Control Panel ......................................................................................... 4-5
4-5 KepcoDCPwr Measure [MSR].vi Block Diagram........................................................................................ 4-6
4-6 Setting the Output, Overall Block Diagram................................................................................................. 4-8
4-7 Front Panel Window ................................................................................................................................... 4-10
4-8 Software Ramp Panel, Current Ramp Example ......................................................................................... 4-12
4-9 Ramp Function Panel, Current Ramp ........................................................................................................ 4-14
4-10 Function Generator Panel .......................................................................................................................... 4-16
4-11 Configure User S
4-12 Ramp Function, Block Diagram.................................................................................................................. 5-17
4-13 Function Generator, List Functionality, Block Diagram.............................................................................. 5-19
5-1 Example 1: Setting Voltage and Current .................................................................................................... 5-4
5-2 Example 2: Using the power supply to create a voltage ramp ................................................................... 5-5
5-3 Example 3: Using the power supply to Take Measurements ..................................................................... 5-7
5-4 Instrument Setup Window .......................................................................................................................... 5-9
5-5 Main Panel window .................................................................................................................................... 5-10
5-6 Protection Window ..................................................................................................................................... 5-11
5-7 Store/Recall Window .................................................................................................................................. 5-11
5-8 Trigger Window .......................................................................................................................................... 5-11
5-9 Calibration Window .................................................................................................................................... 5-12
5-10 Limit Model Window ................................................................................................................................... 5-12
5-11 Utilities Window.......................................................................................................................................... 5-13
5-12 Utilities Window with Output Test Running ................................................................................................ 5-13
5-13 Power Supply Event Window ..................................................................................................................... 5-14
6-1 Message Structure ..................................................................................................................................... 6-4
6-2 Tree Diagram of SCPI Commands Used with KLR Power Supply............................................................. 6-6
6-3 Typical Example Of KLR Power Supply Program Using SCPI Commands ............................................... 6-9
8-1 RS 232 Implementation [Standard Models Only] ....................................................................................... 8-2
A-1 GPIB Commands ....................................................................................................................................... A-5
B-1 Programming the Output............................................................................................................................ B-3
B-2 Using LIST Commands and Queries.......................................................................................................... B-8
B-3 Programming Limit Models......................................................................................................................... B-10
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
equence.vi Block Diagram ............................................................................................. 4-16
vi KLR DEVGD 060713
Page 9
LIST OF TABLES
TABLE TITLE PAGE
1-1 VISA Resource String Corresponding to Interface .....................................................................................1-2
2-1 Front Panel Lockout Commands ................................................................................................................2-2
2-2 RS 232 Setup ..............................................................................................................................................2-4
3-1 KLR IVI-COM Driver Functions ...................................................................................................................3-3
4-1 KLR LabView G Driver Functions ...............................................................................................................4-2
4-2 K
4-3 Error (or Explain Warning) Codes ...............................................................................................................4-4
4-4 K
5-1 KLR VXI plug&play Driver Functions ..........................................................................................................5-1
6-1 Rules Governing Shortform Keywords ........................................................................................................6-4
6-2 VISA Resource String Corresponding to Interface .....................................................................................6-8
7-1 IEEE 488 Port Connector (J4) Pin Assignments .........................................................................................7-1
7-2 IEEE 488 (GPIB) Bus Interface Functions ..................................................................................................7-2
7-3 IEEE 488 (GPIB) Bus Command Mode Messages .....................................................................................7-2
7-4 IEEE 488 (GPIB) Bus Data Mode Messages ..............................................................................................7-3
9-1 Telnet Port 5024 and SCPI Raw Port 5025 Control Characters .................................................................9-1
A-1 IEEE 488.2 Command/query Index ........................................................................................................... A-1
A-2 Standard Event Status Enable Register and Standard Event Status Register Bits ................................... A-1
A-3 Service Request Enable and Status Byte Register Bits ............................................................................. A-6
B-1 SCPI Subsystem Command/query Index .................................................................................................. B-1
B-2 Operation Condition Register, Operation Enable Register,
B-3 Questionable Event Register, Questionable Condition Register
B-4 Factory Default Calibration Passwords ...................................................................................................... B-24
B-5 Error Messages .......................................................................................................................................... B-25
epcoDCPwr Configure Voltage Level.vi Input/Output Descriptions ........................................................4-4
epcoDCPwr Measure [MSR].vi Input/Output Descriptions ......................................................................4-6
and Operation Event Register Bits .......................................................................................................... B-16
and Questionable Condition Enable Register Bits ..................................................................................B-18
KLR DEVGD 020498 vii
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., Flush­ing, 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.1 GENERAL DESCRIPTION

The KLR is a power supply class of instrument. The KLR supports all Power supply class func­tionality 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.1 DRIVERS

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 com­mand 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 possi­ble 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 060713 1-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-RAW TCIP::192.168.0.100::5025::SOCKET This is the fastest LAN interface, similar to the serial port with
LAN-VXI-11 TCIP::192.168.0.100::INSTR This LAN interface requires a more complex handshake for data
VISA RESOURCE STRING COMMENT
GPIB::xx::INSTR The GPIB address replaces xx.
ASRLy::INSTR The 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.2 COMMUNICATION

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.3 PROGRAMMING

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.2 DRIVER OVERVIEW

The three drivers for KLR all have common functional groups Each group contains similar func­tions 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, trig­ger, 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-2 KLR-DEV 060713
Page 13

1.2.1 INITIALIZATION

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.2 OUTPUT 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.3 MEASUREMENT

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.

1.2.4 LIMIT MODELS (USER-DEFINED VOLTAGE/CURRENT LIMITS)

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 pass­word protected.

1.2.5 SAVE/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 per­formed. 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.6 LIST (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 user­determined 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 060713 1-3
Page 14
NOTES: 1. When programming sequential voltage levels, it is important to set the Overvoltage

1.2.7 STATUS

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 inter­rupts 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 termi­nate a running LIST program.
5. The LIST capability is disabled for master /slave configurations and all LIST com­mands 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 avail­ability. 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.1 STATUS 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 Ques­tionable 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-4 KLR-DEV 060713
Page 15
For example, if an overvoltage error is detected, bit 0 of the Questionable Status Condition reg­ister is set. The 0 to 1 transition causes bit 0 to be stored as a 1 in the corresponding Event reg­ister. 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 060713 1-5
Page 16
When the service request is executed, the STB register bits are read: bit 3 set indicates Ques­tionable 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 indi­cated 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.2 STATUS 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 Sum­mary (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.3 STANDARD EVENT STATUS REGISTER SET

The Standard Event Status register set is comprised of the Event Status (ESR) and Event Sta­tus Enable (ESE) registers. The ESR register is read by issuing the *ESR? Query (see Appen­dix 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-6 KLR-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.4 OPERATION STATUS REGISTER SET

The Operation Status register set is comprised of condition, transition, event and enable regis­ters (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 regis­ter 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.5 QUESTIONABLE STATUS REGISTER SET

The Questionable Status register set is comprised of condition, transition, event and enable reg­isters (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/sig­nals which give an indication of the quality of various aspects of the signal.
KLR-DEV 060713 1-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 associ­ated 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.
4 - Input Power Error — 1 indicates input mains error.
5 - Fan Error — 1 indicates inoperative fan.
6 - Master/Slave Error — 1 indicates communication error between master and slave units.
7 - 15 — Not used (always zero).

1.2.7.6 ERROR/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.8 TRIGGER

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 pre­set 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-8 KLR-DEV 060713
Page 19

2.1 INTRODUCTION

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 mod­els 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.2 FRONT PANEL (LOCAL) CONTROL

Front panel control is the default upon power up (see the KLR User Manual). The unit automati­cally 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 060713 2-1
Page 20

TABLE 2-1. FRONT PANEL LOCKOUT COMMANDS

Environment Command Description
Programming SYSTem:KLOCk Follow with on or off. Setting on locks the front panel.
VXI plug&play Kp_KLR_SetResetKeyblock Requires the instrument session and a Boolean value of 0 for off and 1
LabView G Kepco Serial initialize with options The input defaults to lock the keyboard.
IVI-COM Requires the instrument session and a Boolean value of 0 for off and 1
to lock the keyboard.
to lock the keyboard.

2.3 DIGITAL CONTROL VIA LAN [E-SERIES MODELS ONLY]

Figure 2-1 shows all the ports available to the LAN interface. These port are described in Sec­tion 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 inter­face.) This port supports up to eight connections. For details as to how to access, oper­ate 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 discov­ery when sent as a UDP broadcast message. The only command supported is the GET­PORT. 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 pro­tocol proposed by Version 1.2 of the LXI specification.
Port 1024 - VXI-11. This port supports up to two connections. VXI-11 uses one stan­dard 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 pro­vided 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 Devel­oper’s Guide allow the operation of the unit via the Telnet port.
2-2 KLR-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.4 DIGITAL 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 Pro­grammable 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, PRO­GRAMMING THE KLR USING SCPI COMMANDS, and Section 7, IEEE 488.2 (GPIB) INTER­FACE. for additional details on using the GPIB interface.

2.5 DIGITAL 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 avail­able 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 termi­nal 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 Bits 1
•Echo OFF
XON ON (enabled)
KLR-DEV 060713 2-3
Page 22
NOTE: Kepco strongly recommends the XON XOFF method for data transfer via RS 232 proto­col 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 (transmis­sion 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 nor­mal 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 IVI­COM 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

Environment Method
IVI-COM Automatically enabled
LabView Automatic - uses Kepco Serial Initialize
VXI plug&play KpKLR_Serial Initialize
2-4 KLR-DEV 060713
Page 23

SECTION 3 - IVI-COM DRIVER

3.1 INTRODUCTION

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 program­ming of the KLR via either the LAN (E-Series models only), GPIB (all models) or RS 232 (stan­dard 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 IVI­COM driver does not support the configuring and resetting of overvoltage and overcurrent con­ditions.

3.1.1 SPECIFICATION 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 instru­ment interchangeability. This IVI-COM driver complies with the following IVI standards:
• IVI 3.1 - IVI Driver Architecture Specification
• IVI 3.2 - Inherent Capabilities Specification
• 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.2 RANGE CHECKING AND COERCION

The driver will predominantly rely upon the instrument to perform range checking and coercion.

3.1.3 MULTITHREADING 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 appli­cations.
KLR-DEV 060713 3-1
Page 24

3.1.4 CONTEXT-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.5 INSTALLER

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 Archi­tecture 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 regis­tering the files.

3.1.6 RIGHTS

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. Disassem­bly and/or modification of the IVI-COM driver is expressly forbidden.

3.2 IVI-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-2 KLR-DEV 060713
Page 25
TABLE 3-1. KLR IVI-COM DRIVER FUNCTIONS
Function Name Purpose
Initialization
KpDCPwr_init Initialize Power supply, create session handle.
KpDCPwr_InitWithOptions Initialize power supply, allowing user to determine reset and identifi-
KpDCPwr_close Close session handle.
KpDCPwr_LockSession Prevents other instrument tasks from accessing unit.
KpDCPwr_UnlockSession Allows other instrument tasks to access unit.
KpDCPwr_reset Sends reset to unit setting output off
KpDCPwr_revision_query Gets the revision level of the power supply
KpDCPwr_AttachToExistingCOMSession Allows second usage of driver
KpDCPwr_serial_query Gets the serial number of the power supply
KpDCPwr_cal_date_query Gets the calibration date of the power supply
Output Control Functions
KPDCPWR_ATTR_OUTPUT_ENABLED Boolean is used to set the output on and off with this attribute
KPDCPWR_ATTR_VOLTAGE_LEVEL Sets or reads back the output voltage of power supply.
KPDCPWR_ATTR_CURRENT_LIMIT Sets and read back the output current level.
KPDCPWR_ATTR_POSITIVE_CURRENT_LIMIT Sets the current limit level.
KpDCPwr_MeasureCurrent Measure current function.
KpDCPwr_MeasureVoltage Measure Voltage function.
KPDCPWR_ATTR_OUTPUT_MODE Indicates 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_LEVEL Sets the current trigger level.
KPDCPWR_ATTR_TRIGGERED_VOLTAGE_LEVEL Sets the triggered voltage level of the power supply.
KPDCPWR_ATTR_TRIGGERED_CURRENT_LIMIT Sets the triggered current protect level of the KLR.
KPDCPWR_ATTR_TRIGGER_SOURCE Sets and views the trigger source.
KPDCPWR_ATTR_INIT_CONTINUOUS Enables continuous or single trigger events.
KpDCPwr_ConfigureTriggerSource Allows selection of the trigger source from External or software trig-
KpDCPwr_ConfigureTriggeredCurrentLimit Sends the current trigger level to the power supply.
KpDCPwr_ConfigureTriggeredVoltageLevel Send the voltage trigger level to the power supply.
KpDCPwr_Abort Sends abort to the KLR, preventing a trigger event from changing
cation options.
on the KLR.
Sets the current protection level.
Sets the voltage protection level.
Output trigger
gers.
the power supply output.
KLR-DEV 060713 3-3
Page 26
TABLE 3-1. KLR IVI-COM DRIVER FUNCTIONS (CONTINUED)
Function Name Purpose
List (supported in standalone configurations only)
KpDCPwr_ClearLists Empties all lists. Prepares the KLR to receive a new list.
KpDCPwr_SetVoltageListValues Sends the new voltage point to the KLR.
KPDCPWR_ATTR_VOLTAGE_LIST_POINTS Provides the location of the next point to be entered into voltage list.
KpDCPwr_SetCurrentListValues Sends the new current point to the KLR.
KPDCPWR_ATTR_CURRENT_LIST_POINTS Provides the location of the next point to be entered into current list.
KpDCPwr_SetListDwellTimes Sends the new dwell point to the KLR.
KPDCPWR_ATTR_LIST_DWELL_POINTS Provides the location of the next point to be entered into dwell list.
KpDCPwr_SetListControl Sends the new relay point to the KLR.
KPDCPWR_ATTR_LIST_CONTROL_POINTS Provides the location of the next point to be entered into control
(relay) list.
KPDCPWR_ATTR_LIST_SKIP Provides ability to skip a number of points when a list is repeatedly
KpDCPwr_ExecuteVoltageList Causes a list to be executed.
KpDCPwr_HaltVoltageList Causes a list to be stopped; useful when list is executed continu-
KpDCPwr_SetListCycles Causes the list to be executed a number of times. Sending 0 will
KPDCPWR_ATTR_LIST_CYCLES Provides number of cycles for a list to be executed. The clear list
KpDCPwr_EnablePasswordState Enables Password controlled conditions.
KPDCPWR_ATTR_POSITIVE_CURRENT_RATED_LIMIT Limit model current limit
KPDCPWR_ATTR_POSITIVE_VOLTAGE_RATED_LIMIT Limit model voltage limit
KpDCPwr_DisablePasswordState Turn off password enable
KpDCPwr_ChangePassword Allows for changing the password of the power supply.
executed.
ously.
make list execute forever.
sets this variable to 1.
Utility

3.3 EXAMPLES USING C

The examples illustrated in the following paragraphs are installed in the ivi\drivers\kepco\exam­ples folder during installation of the IVI-COM driver. Figures showing the complete code for each example are provided

3.3.1 SETTING 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-4 KLR-DEV 060713
Page 27
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This program demonstrates how to set a voltage and current and measure the output voltage using the IVI-COM driver. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <stdafx.h> #include <stdio.h> #include <conio.h> #include <atlbase.h>
#import "IviDriverTypeLib.dll" no_namespace #import "IviDCPwrTypeLib.dll" no_namespace #import "KepcDCPwr.dll" no_namespace
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 neces­sary 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.
bstrInstrFwRev = driverPtr->Identity->InstrumentFirmwareRevision;
Accessing properties requires many pointer operations. The examples below use pointer redi­rection to make the operations a little clearer.
// get pointers to the needed interfaces IKLROutputPtr outputPtr; outputPtr = driverPtr->Outputs->GetItem(OLESTR("Output"));
IKLRMeasurementPtr measurementPtr; measurementPtr = driverPtr->Measurements->GetItem(OLESTR("Measurement"));
KLR-DEV 060713 3-5
Page 28
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. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <stdafx.h> #include <stdio.h> #include <conio.h> #include <atlbase.h>
#import "IviDriverTypeLib.dll" no_namespace #import "IviDCPwrTypeLib.dll" no_namespace #import "KepcDCPwr.dll" no_namespace
int main(int argc, char* argv[]) { HRESULT hr;
try {
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);
FIGURE 3-1. EXAMPLE OF SETTING THE OUTPUT AND TAKING A MEASUREMENT,
WRITTEN IN C++ (SHEET 1 OF 2)
3-6 KLR-DEV 060713
Page 29
// open the instrument for communication hr = driverPtr->Initialize(
L"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"));
if (FAILED(hr))
// Get InstrumentFirmwareRevision property. BSTR bstrInstrFwRev; bstrInstrFwRev = driverPtr->Identity->InstrumentFirmwareRevision; wprintf(L"InstrumentFirmwareRevision: %s\n", bstrInstrFwRev);
// get pointers to the needed interfaces IKLROutputPtr outputPtr; outputPtr = driverPtr->Outputs->GetItem(OLESTR("Output"));
IKLlnMeasurementPtr measurementPtr; measurementPtr = driverPtr->Measurements->GetItem(OLESTR("Measurement"));
// 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 060713 3-7
Page 30

3.3.2 USING 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 con­figured 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.
using System; using KepcoDCPwr.Interop;
// Create driver instance. KepcoDCPwr KLRdriver; KepcoDCPwr.Interop.Output outputPtr; KepcoDCPwr.Interop.IList listPtr; KLRdriver = new KepcoDCPwrClass();
The connection between the host and the KLR is then established by the following code:
KLRdriver.Initialize("GPIB0::6::INSTR",
true, true,
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-
late=false");//IVI options
// get references to the needed interfaces outputPtr = KLRdriver.Outputs.get_Item(driver.Outputs); listPtr = KLRdriver.List.get_Item(driver.Lists);
The list functionality uses arrays. The following code creates these arrays and then fills them with data.
//create arrays for the ListPoints method double[] voltList = new double [6]; double[] currList = new double [6]; double[] dwellTime = new double [6];
voltList[0] = 10; voltList[1] = 20; voltList[2] = 30; voltList[3] = 40; voltList[4] = 50; voltList[5] = 60;
currList[0] = 2; // select max current for each step currList[1] = 2; currList[2] = 2; currList[3] = 2;
3-8 KLR-DEV 060713
Page 31
currList[4] = 2; currList[5] = 2;
dwellTime[0] = 1; dwellTime[1] = 2; dwellTime[2] = 3; dwellTime[3] = 4; dwellTime[4] = 5; dwellTime[5] = 0.01;
The following command uses the IVI-COM driver to send the lists to the KLR. Note that the arrays are passed by reference to the driver.
listPtr.ListPoints(ref voltList, ref currList, ref dwellTime);
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) {
// Create driver instance. KepcoDCPwr KLRdriver; KepcoDCPwr.Interop.IOutput outputPtr; KepcoDCPwr.Interop.IList listPtr; KLRdriver = new KepcoDCPwrClass();
try {
FIGURE 3-2. EXAMPLE OF USING A LIST, WRITTEN IN C# (SHEET 1 OF 2)
KLR-DEV 060713 3-9
Page 32
// Initialize driver KLRdriver.Initialize("GPIB0::6::INSTR",
true, true, "Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-
late=false");//Optional ivi options
System.Console.WriteLine("Done.\n");
// get references to the needed interfaces outputPtr = KLRdriver.Outputs.get_Item(driver.Outputs); listPtr = KLRdriver.List.get_Item(driver.Lists);
//create arrays for the ListPoints method double[] voltList = new double [6]; double[] currList = new double [6]; double[] dwellTime = new double [6];
voltList[0] = 10; voltList[1] = 20; voltList[2] = 30; voltList[3] = 40; voltList[4] = 50; voltList[5] = 60;
currList[0] = 2; // select max current for each step currList[1] = 2; currList[2] = 2; currList[3] = 2; currList[4] = 2; currList[5] = 2;
dwellTime[0] = 1; dwellTime[1] = 2; dwellTime[2] = 3; dwellTime[3] = 4; dwellTime[4] = 5; dwellTime[5] = 0.01;
//' call ListPoints to set the list values and set the voltage and current modes to
LIST
listPtr.ListPoints(ref voltList, ref currList, ref dwellTime);
// enable the output outputPtr.Enabled = true;
// Set the number of executions. listPtr.count = 2;
// initiate the list in the output system outputPtr.listInitiate();
KLRdriver.Systems.WaitForOperationComplete(10000);
//Read instrument errors ReadInstrumentError(driver);
//' Close driver if initialized. if (KLRdriver.Initialized == true ) KLRdriver.Close();
Console.WriteLine(); Console.Write("Press Enter to Exit ");
Console.ReadLine(); } catch (Exception e) {
Console.WriteLine();
Console.WriteLine("Exception Error:");
Console.WriteLine(" " + e.Message );
KLRdriver.Close();
Console.WriteLine();
Console.Write("Press Enter to Exit ");
Console.ReadLine(); }
}
} }
FIGURE 3-2. EXAMPLE OF USING A LIST, WRITTEN IN C# (SHEET 2 OF 2)
3-10 KLR-DEV 060713
Page 33

3.3.3 SETTING LIMIT MODEL

This example is a series of files found on the CD in the
ivi\drivers\kepcodcpwr\example\cviVirtual directory.
In CVI you just need to open the .prj file to access the entire project
Note: This project file establishes a link to the kepcodcpwr.fp file by using the Edit menu ->
project -> Function panel file. To create another project this step is critical to proper operation of the driver under the CVI environment.
In CVI each C file in the project needs to invoke the various include files.
#include "KpDCPwr.h" #include <ansi_c.h> #include <cvirte.h> #include <visatype.h> #include "KpDCPwrErrorHandler.h" #include "KpDCPwrExample.h"
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.
sprintf(initOptions, "QueryInstrStatus=1, Simulate=%d", simulate);
// Initialize the driver
checkErr(KpDCPwr_InitWithOptions(resourceName, VI_TRUE, VI_TRUE,
initOptions, &vi));
// Enable the password state
checkErr(KpDCPwr_EnablePasswordState(vi, “7532”));
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,
KPDCPWR_ATTR_POSITIVE_VOLTAGE_RATED_LIMIT, voltageLimit));
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 060713 3-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.4 EXAMPLES USING VISUAL BASIC

The following paragraphs are example of how to use code written in Visual Basic to set the out­put and take a measurement, and how to use a list to perform as series of operations

3.4.1 SETTING 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 mea­surement. The filename for this example is VBOutputExample.txt, located in the ivi\driv­ers\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 stan­dard 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 KLR­specific 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-12 KLR-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 060713 3-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-14 KLR-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.2 USING 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
Private Sub cmdExit_Click() Unload Me End Sub
Private Sub cmdStart_Click()
Set driver = New KepcoDCPwr
On Error GoTo errorHandler
' initialize the driver
driver.Initialize "GPIB0::6::INSTR", _ False, _ True, _ "Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simulate=false"
Dim result As Boolean result = driver.Initialized
' 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 060713 3-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.3 SETTING LIMIT MODEL

The filename for this example is VBlimit model Example.txt, located in the ivi\driv­ers\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 per­form 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-16 KLR-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.
driver.KpDCPwr_SetAttributeViReal64 KPDCPWR_ATTR_POSITIVE_VOLTAGE_RATED_LIMIT, 36 driver.KpDCPwr_SetAttributeViReal64 KPDCPWR_ATTR_POSITIVE_CURRENT_RATED_LIMIT, 32
driver.Close
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.5 EXAMPLES 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 060713 3-17
Page 40

3.5.1 SETTING 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 ref­erence which performs the driver close, breaking the connection to the KLR, and the instrumen­tation close which releases the memory used by the driver.

FIGURE 3-6. SETTING THE OUTPUT USING LABVIEW WITH IVI-COM DRIVER

3.5.2 GETTING 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-18 KLR-DEV 060713
Page 41

FIGURE 3-7. MEASURING VOLTAGE AND CURRENT USING LABVIEW WITH IVI-COM DRIVER

3.5.3 CHANGING 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 060713 3-19/(3-20 Blank)
Page 42
Page 43

4.1 INTRODUCTION

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 com­puter.

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.2 LABVIEW G INSTRUMENT DRIVER

The LabView G driver is a multipurpose driver. It is capable of operating all Kepco Power sup­plies 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.3 LABVIEW 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 inter­active 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 060713 4-1
Page 44

TABLE 4-1. KLR LABVIEW G DRIVER FUNCTIONS

Function Name Purpose
KepcoDCPWR initialize with options Makes Visa Connection. Creates Open handle
KepcoDCPWR initialize Makes Visa Connections, No Reset, IDN is parsed and Kepco
Kepco Serial initialize with options Makes Visa Connection. Creates Open handle
KepcoDCPWR close Closes the driver, freeing resources
Recognize Model Sends *IDN? And verifies KEPCO string returned
KepcoDCPWR IDN parser Parse the IDN string – determining model
KepcoDCPWR Revision Query Uses IDN parser to determine firmware revision
KepcoDCPWR Reset Sends *RST to Power supply, set output off, volt=0, curr min,
KepcoDCPWR Reset with Defaults Supplied for compatibility purposes uses above
KepcoDCPWR Self-test Sends *TST? To unit and returns result- o= all okay.
Output Control functions
KepcoDCPWR Configure Voltage Level Set voltage output setting to a specific value
KepcoDCPWR Configure Current Level Sets current output setting to a specific level
KepcoDCPWR Query Voltage Level Queries 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 Level Queries unit and returns Current level setting
KepcoDCPWR Configure Voltage Limit Set virtual voltage setting to a specific value
KepcoDCPWR Configure Current Limit Sets virtual current setting to a specific level
KepcoDCPWR Query Voltage Limit Queries unit and returns limit model voltage level setting
KepcoDCPWR Query Current Limit Queries unit and returns limit model Current setting
KepcoDCPWR Configure OVP Set over voltage setting to a specific value
KepcoDCPWR Configure OCP Sets Over current setting to a specific level
KepcoDCPWR Configure Output State Sets output on or off
KepcoDCPWR Query Output State Returns 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 Mode Sets unit to List or Fixed mode of operation. Fixed operation is
KepcoDCPWR Configure Voltage Mode Sets unit to List or Fixed mode of operation. Fixed operation is
KepcoDCPWR Configure User Sequence Initializes 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-2 KLR-DEV 060713
Page 45
TABLE 4-1. KLR LABVIEW G DRIVER FUNCTIONS (CONTINUED)
Function Name Purpose
KepcoDCPWR Clear All Lists Clears the list if not executing.
KepcoDCPWR Configure List Loads a specific list from an array of numbers.
KepcoDCPWR Configure List Count Initializes the list count variable
Trigger Functions
KepcoDCPWR Configure Triggered Current Level Establishes the current level upon receipt of a valid trigger
KepcoDCPWR Configure Triggered Voltage Level Establishes the voltage level upon receipt of a valid trigger
KepcoDCPWR Configure Triggered Source Establishes 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-Query Provides entry from the error queue of the power supply.

4.4 USING 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, fol­lowed 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.1 KepcoDCPwr Configure Voltage Level.vi

This VI configures the DC voltage level the power supply is expected to generate.

4.4.1.1 CONNECTOR PANEL

FIGURE 4-1. KepcoDCPwr Configure Voltage Level.vi CONNECTOR PANEL

4.4.1.2 CONTROLS AND INDICATORS

See Table 4-2.
KLR-DEV 060713 4-3
Page 46

TABLE 4-2. KepcoDCPwr Configure Voltage Level.vi INPUT/OUTPUT DESCRIPTIONS

DESCRIPTION SYMBOL
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 - 27 Default 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
Model In - 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 chan­nel 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 pop­up 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.3 BLOCK 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 func­tion, 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-4 KLR-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 modi­fication.

FIGURE 4-3. KepcoDCPwr Configure Voltage Level.vi ERROR BLOCK DIAGRAM

4.4.2 KepcoDCPwr 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).
KLR-DEV 060713 4-5
Page 48

TABLE 4-4. KepcoDCPwr Measure [MSR].vi INPUT/OUTPUT DESCRIPTIONS

DESCRIPTION SYMBOL
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: 1 Default 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-5. KepcoDCPwr Measure [MSR].VI BLOCK DIAGRAM

4.5 EXAMPLE OF SETTING THE OUTPUT

Figure 4-6 shows the use of the Kepco subvi's to initialize the driver and the device, set the out­put 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 Exam­ple.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-6 KLR-DEV 060713
Page 49

4.5.1 INITIALIZATION 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 volt­age 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, mini­mum 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 Stan­dard 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 060713 4-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-8 KLR-DEV 060713
Page 51

4.5.2 SET 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.3 GET 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.4 CLOSE 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 auto­matically turned off. Therefore it is recommended that the KepcoDCPWR Configure Output State 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 060713 4-9
Page 52

4.6 INTERACTIVE DEMONSTRATION PROGRAM

The interactive demo program allows the user to operate the power supply and provides sam­ples of how to implement the functions.

4.6.1 KepcoDCPwr 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-10 KLR-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 sup­ply. 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 060713 4-11
Page 54

4.6.2 SOFTWARE 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 volt­age 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-12 KLR-DEV 060713
Page 55
The four boxes labeled Start (beginning of ramp), End (end of ramp), Voltage Increment [or Cur­rent 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 val­ues 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 060713 4-13
Page 56

4.6.3 SOFTWARE 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, mea­sure 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-14 KLR-DEV 060713
Page 57
4.6.4 FUNCTION 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 cur­rent, and depend on the load to sink current. KLR Models with R Option can sink cur­rent 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, peri­odic 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 rep­etitions.
KLR-DEV 060713 4-15
Page 58

FIGURE 4-10. FUNCTION GENERATOR PANEL

FIGURE 4-11. CONFIGURE User Sequence.vi BLOCK DIAGRAM

4-16 KLR-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.1 INTRODUCTION

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.2 VXI 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.3 VXI 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 sup­ported 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 opera­tion or operating other Kepco supplies.
Table 5-1 lists the functions that are available.
TABLE 5-1. KLR VXI PLUG&PLAY DRIVER FUNCTIONS
Purpose Function Name Description
INITIALIZE FUNCTION
Initialize Unit Kpklr_Init A 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.
Reset Kpklr_psReset Resets the instrument to a known state and sends initialization com-
mands to the instrument.
Close Kpklr_close This function takes the instrument off-line.
SETTING AND MONITORING OUTPUT FUNCTIONS
Set Value Kpklr_SetValue Sets the output voltage, the output current of the power supply,
Get Value Kpklr_GetValue Gets 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 pro­tection
rent protection of the power supply depending on slide selection position0 - voltage, 1 - current, 2 - voltage protection, 3 - current pro­tection.
KLR-DEV 060713 5-1
Page 64
TABLE 5-1. KLR VXI PLUG&PLAY DRIVER FUNCTIONS (CONTINUED)
Purpose Function Name Description
Measure Current and Voltage Output Values
SETTING AND MONITORING OUTPUT FUNCTIONS (CONTINUED)
Get Source Mode Kpklr_GetSourceMode Gets the operating mode of the power supply.
Output On/Off Kpklr_OutputOnOff Sets the output on or off.
Get Output Status Kpklr_getOutputState Returns the output status (on or off).
UTILITY FUNCTIONS
Relay Mode Kpklr_GetRelayMode Gets operating mode of instrument relay. 0 = Fault (factory default),
Get Relay Status Kpklr_GetRelayStatus Gets on/off status of instrument relay.
Set Relay Status Kpklr_SetRelayStatus Sets relay on (energized) or off (de-energized) if Relay Mode is set to
Set/reset Front Panel Lock
Front Panel Lock Status Kpklr_KeybLockStat Gets status of front panel lockout
Revision Query Kpklr_RevisionQuery Returns the revision numbers of the instrument driver and instrument
Model Query Kpklr_ModelQuery Return the model number of the KLR power supply.
Serial Number Query Kpklr_SerialnQuery Returns the serial number of the KLR power supply. The serial num-
Query SCPI Version Kpklr_GetScpiVersion Returns the power supply answer to the Query SCPI Version com-
Self-Test Kpklr_selfTest Runs the instrument's self test routine and returns the test result(s).
Error-Query Kpklr_errorQuery Reads an error code from the instrument's error queue.
Error Message Kpklr_errorMessage Takes the Status Code returned by the instrument driver functions,
Get System Setting Kpklr_SYST_Set Gets System Settings
Get Trigger Value Kpklr_GetTrigValue Gets the trigger voltage or the trigger current level, depending on the
Set Trigger Value Kpklr_SetTrigValue Sets the trigger voltage or trigger current level, depending on the
Trigger Kpklr_Trig Triggers the instrument once. The output will go to the trigger voltage
LIMIT MODEL FUNCTIONS
Set Max Voltage/Current Kpklr_SetMaxLimValue Sets limit to maximum voltage/current.
Get Max Voltage/Current Kpklr_GetMaxLimValue Gets maximum voltage/current limit values.
Security Code Kpklr_CalCode Allows the user to change the password to prevent accidental or
Calibration Dump Kpklr_CalDump Instrument sends calibration data in Intel Hex format.
Kpklr_MeasVoltCurr Measures the values of output (voltage and current).
1 = Manual, 2 = List Program
Manual (1).
Kpklr_SetResetKeyblock Sets or resets front panel controls lockout.
firmware version from the *idn? query. This instrument driver's Revi­sion 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 Instru­ments (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 pass­word. If the password is lost, call the factory for support.
5-2 KLR-DEV 060713
Page 65
TABLE 5-1. KLR VXI PLUG&PLAY DRIVER FUNCTIONS (CONTINUED)
Purpose Function Name Description
Calibration Restore Kpklr_CalRestore instrument receives calibration data in Intel hex format and replaces
the Working Calibration.
ARBITRARY WAVEFORM FUNCTIONS (Standalone configuration only)
Clear List Kpklr_ListCl Clears the list to prepare for adding points.
Add Volt Step Value Kpklr_ListVolt Add a single voltage entry to the end of a list.
Add Current Step Value Kpklr_ListCurrent Add a single current entry to the end of a list.
Add Step Time Kpklr_ListDwell Add a single time entry to the end of a list.
Add relay control step value
Query How Many Points Kpklr_Points Determines the maximum number of points on the list.
Add waveform to a list Kpbop_ListData Add waveform to a list.
Set list execution cycles Kpklr_ListCount A list can be run from 1- 65535 times. It can also be run continuously
Run/stop LIST program Kpklr_Prog Runs or stops LIST program.
LIST Program Run Status Kpklr_Prog_Stat Status of LIST program (running or stopped)
STATUS FUNCTIONS
Set SRQ Condition Kpklr_SetSrqCond Sets SRQ Condition Bit.
Display Status Message Kpklr_getDisplay Displays message in Status Display.
Initialize Status Registers Kpklr_InitReg Clears status Operation and Event registers
Get Questionable Event Kpklr_StatQues Tests and returns contents of Questionable Event register.
Wait for Operation to Complete
Wait for SRQ Kpklr_WaitSrq Waits for SRQ
Kpklr_ListControl Add 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.4 USING 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.1 EXAMPLE 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 pos­sible 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.
KLR-DEV 060713 5-3
Page 66
#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 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 */
ViStatus Set_powersupply (ViReal64 voltage, ViReal64 current){
ViByte ps_type; ViSession KLR_Session;
ViStatus power_supply_status = VI_SUCCESS;
/* 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-4 KLR-DEV 060713
Page 67

5.4.2 EXAMPLE 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 program­ming 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
if ( (power_supply_status = Kpklr_init ( &id_str, 1, &ps_type, &KLR_Session)) !=Visuccess)
/* 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 060713 5-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-6 KLR-DEV 060713
Page 69

5.4.3 EXAMPLE 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 */
}
ViStatus Get_powersupply (ViReal64 *voltage, ViReal64 *current){
ViStatus power_supply_status = VI_SUCCESS;
return (power_supply_status); } // end of readback
if (Kpklr_init ( &id_str, 1, &ps_type, &KLR_Session) !=Visuccess)
return; // could not open power supply Set_powersupply(15,12); delay (100);
Kpklr_MeasVoltCurr (KLR_session, *meas_volt, *meas_curr); Kpklr_close(KLR_Session); // free up the memory and close visa session
FIGURE 5-3. EXAMPLE 3: USING THE POWER SUPPLY TO TAKE MEASUREMENTS (SHEET 1 OF 2)
KLR-DEV 060713 5-7
Page 70
/* 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
*/
ViStatus Set_powersupply (ViReal64 voltage, ViReal64 current){
ViStatus power_supply_status = VI_SUCCESS;
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-8 KLR-DEV 060713
Page 71

5.5 DEMONSTRATION 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 pro­vided 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.1 INSTRUMENT 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 correspond­ing 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 dis­played 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 Con­tinue button to open the main panel (Figure 5-5).

FIGURE 5-4. INSTRUMENT SETUP WINDOW

KLR-DEV 060713 5-9
Page 72

5.5.2 MAIN 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 dis­play 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-10 KLR-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 but­ton 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 sup­ply output to be programmed to the settings stored in the Trigger Voltage and Trigger Current displays.

FIGURE 5-8. TRIGGER WINDOW

KLR-DEV 060713 5-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 configura­tions; 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 ver­sion 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 Cali­bration Password (see KLR User Manual) must be entered. Once either limit is altered, the out­put 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-12 KLR-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 but­tons, 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 previ­ously 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 cal­ibration.
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 cir­cuit 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 appli­cation.
KLR-DEV 060713 5-13
Page 76

5.5.3 POWER 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, other­wise the VXI plug&play application will terminate incorrectly.

FIGURE 5-13. POWER SUPPLY EVENT WINDOW

5-14 KLR-DEV 060713
Page 77

SECTION 6 - PROGRAMMING THE KLR USING SCPI COMMANDS

6.1 SCPI PROGRAMMING

SCPI (Standard Commands for Programmable Instruments) is a programming language con­forming 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 com­mands are sent to the KLR Power Supply as ASCII output strings within the selected program­ming 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 repre­senting 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.2 SCPI 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.3 COMMON 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.4 SCPI 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; subsys­tem commands are defined and explained in Appendix B.

6.4.1 DISPLAY SUBSYSTEM

This subsystem returns the character string displayed in the Status display.

6.4.2 TRIGGER 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 060713 6-1
Page 78

6.4.3 ABORT 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.4 LIST 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 config­ured 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.5 MEASURE SUBSYSTEM

This query subsystem returns the voltage and current measured at the power supply's output terminals.

6.4.6 OUTPUT SUBSYSTEM

This subsystem controls the power supply's output state: on or off.

6.4.7 STATUS 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.8 STORAGE 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.9 SYSTEM SUBSYSTEM

This subsystem controls the RS 232 port, GPIB address, passwords, security, language, key­board 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 gener­ate a voltage or current transient from 0.04 to 655.36 seconds in length.
6-2 KLR-DEV 060713
Page 79

6.4.11 CALIBRATE 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 com­mands, refer to Kepco’s website (www.kepcopower.com/drivers) and download the LabWindows/CVI Ver­sion 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.
CAL:CEXT command CAL:CGA command CAL:CURR:LEV command CAL:CURR[:DATA] command CAL:DPOT command CAL:SAVE command CAL:STAT command and query CAL:VEXT command CAL:VGA command CAL:VOLT:LEV command CAL:VOLT[:DATA] command CAL:ZERO command

6.5 PROGRAM MESSAGE STRUCTURE

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 indi­cates the end of a line (“newline” character). The message unit is a keyword consisting of a sin­gle 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 sepa­rated 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 com­mand must use the full syntax shown in Appendix B.

6.5.1 KEYWORD

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 com­pletely (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 060713 6-3
Page 80
To identify the short form and long form in this manual, keywords are written in upper case let­ters 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 LETTERS MODE
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.2 KEYWORD 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-4 KLR-DEV 060713
Page 81

6.5.3 QUERY 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.4 DATA

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.5 DATA SEPARATOR

Data must be separated from the last keyword by a space (e.g., VOLT:LEV:TRIG 14 or SOUR:VOLT? MAX

6.5.6 MESSAGE 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.7 ROOT 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 key­word separators
:INIT ON;:TRIG;:MEAS:CURR?;VOLT? The first three colons are root specifiers.

6.5.8 MESSAGE 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.
KLR-DEV 060713 6-5
Page 82
ROOT : (colon)
ABORt subsystem
ABOR
CALibrate subsystem
CAL
:CEXT :CGA :CURR
:LEV
[:DATA] :DATA :DPOT :SAVE :STAT, :STAT? :VEXT :VGA :VOLT
:LEV
[:DATA] :ZERO
DISPlay subsystem
DISP
[:WIND]:TEXT[:DATA]?
OUTPut subsystem
OUTP
[:STAT] [:STAT]?
TRIGger subsystem
TRIG[:SEQ]
:SOUR :SOUR?
INIT
:IMM
:CONT
:CONT?
STATus subsystem
STAT
:OPER
:COND?
:ENAB
:ENAB?
[:EVEN]? :PRES :QUES
:COND?
:ENAB
:ENAB?
[:EVEN]?
* LIST Subsystem not supported with multiple
units.
** Only supported in standalone units with R
Option (RODC) installed.
[SOURce:] subsystem
[SOUR:] VOLT
[:LEV]
[:IMM]
[:AMPL] [:AMPL?]
:TRIG
[:AMPL]
[:AMPL]? :PROT[:LEV] :PROT[:LEV]? :LIM
:HIGH :HIGH?
:MODE
:MODE FIXED :MODE LIST * :MODE TRANS **
:MODE?
CURR
[:LEV]
[:IMM]
[:AMPL]
[:AMPL?]
:TRIG
[:AMPL]
[:AMPL]? :PROT[:LEV] :PROT[:LEV]? :LIM
:HIGH
:HIGH? :MODE FIXED :MODE LIST * :MODE TRANS ** :MODE?
FUNC:MODE
FUNC:MODE?
LIST subsystem * [part of SOURce]
LIST
:CLE :CONT :CONT? :COUN
:SKIP
:SKIP?
:POIN? :COUN?
:CURR
:POIN?
:CURR? :DIR :DIR? :DWEL :DWEL?
:POIN? :QUER :QUER?
:VOLT
:POIN? :VOLT?
SYSTem subsystem
SYSTem
:COMM
:GPIB
:ADDR :ADDR?
:LAN
:AUTO AUTO? :DHCP :DHCP? :DNS :DNS? :GATE :GATE? :IP :IP? :MAC? :MASK :MASK?
:SER
:BAUD :BAUD? :ECHO :ECHO? :ENAB :ENAB? :PACE :PACE? :PROM :PROM?
:ERRor
[:NEXT]? :CODE?
[:NEXT]?
:ALL? :KLOC :KLOC? :LANG :LANG? :PASS
:CEN [:CEN]:STAT? :CDIS
:NEW
:SEC
:IMM :SET :SET? :VERS?
MEASure subsystem
MEAS
[:SCAL]:CURR[:DC]? [:SCAL]:[VOLT][:DC]?
STORage subsystem
MEM:
LOC LOC?
*SAV *RCL

FIGURE 6-2. TREE DIAGRAM OF SCPI COMMANDS USED WITH KLR POWER SUPPLY

6-6 KLR-DEV 060713
Page 83

6.6 UNDERSTANDING 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
Optional keywords are enclosed in brackets [ ] for identification; optional keywords can be omit­ted 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.7 PROGRAM 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 060713 6-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 mes­sage 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 cur­rent since the colon preceding curr? indicates that curr? is not part of the meas com­mand 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.1 EXCEPTIONS 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.8 PROGRAMMING 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-RAW TCIP::192.168.0.100::5025::SOCKET This is the fastest LAN interface, similar to the serial port with
LAN-VXI-11 TCIP::192.168.0.100::INSTR This LAN interface requires a more complex handshake for data
VISA RESOURCE STRING COMMENT
GPIB::xx::INSTR The GPIB address replaces xx.
ASRLy::INSTR The 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-8 KLR-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"
ViChar rd_str[80]; // Input buffer ViChar dat_str[80]; // Output buffer
/* 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 inter­face */
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 060713 6-9/(6-10 Blank)
Page 86
Page 87

SECTION 7 - IEEE 488.2 (GPIB) INTERFACE

7.1 DIGITAL 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 Pro­grammable 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

PIN SIGNAL NAME FUNCTION
1
2
3
4
5 EOI End or Identify
6 DAV Data Va lid
7 NRFD Not Ready for Data
8 NDAC Not Data Accepted
9 IFC Interface Clear
10 SRQ Service Request
11 ATN Attention
12 SHIELD Shield
13
14
15
16
17 REN Remote Enable
18 GND Ground (signal common)
19 GND Ground (signal common)
20 GND Ground (signal common)
21 GND Ground (signal common)
22 GND Ground (signal common)
23 GND Ground (signal common)
24 LOGIC GND Logic 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.2 IEEE 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 Interface for Programmable Instrumentation) communicating with a Host Computer—Controller (Talker/Lis­tener). 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 mes­sages are enabled during the “handshake” cycle, with the KLR power supply operating as either a Talker or a Listener.
KLR-DEV 060713 7-1
Page 88

TABLE 7-2. IEEE 488 (GPIB) BUS INTERFACE FUNCTIONS

FUNCTION
Source Handshake SH1 Complete Capability (Interface can receive multiline messages)
Acceptor Handshake AH1 Complete Capability (Interface can receive multiline messages)
Talker T6 Basic talker, serial poll, unaddress if MLA (My Listen Address) (one-byte address)
Listener L4 Basic listener, unaddress if MTA (My Talk Address) (one-byte address).
Service Request SR1
Remote/Local RL1
Parallel Poll PP0 No Capability
Device Clear DC1 Complete Capability. KLR accepts DCL (Device Clear) and SDC (Selected Device Clear).
Device Trigger DT1 Respond to *TRG and <GET> trigger functions.
Controller C0 No 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
DCL Device Clear Received
GET Group Execute Trigger Received
GTL Go To Local Received
IFC Interface Clear Received
LLO Local Lockout Received
MLA My Listen Address Received
MTA My Talk Address Received
OTA Other Talk Address Received (Not Used)
RFD Ready for Data Received or Sent
SDC Selected Device Clear Received
SPD Serial Poll Disable Received
SPE Serial Poll Enable Received
SRQ Service Request Sent
UNL Unlisten Received
MESSAGE
DESCRIPTION
COMMENTS
UNT Untalk Received
7-2 KLR-DEV 060713
Page 89

TABLE 7-4. IEEE 488 (GPIB) BUS DATA MODE MESSAGES

MNEMONIC MESSAGE DESCRIPTION COMMENTS
DAB
END
EOS
RQS
STB
Data Byte Received or Sent
End Received or Sent
End of String Received or Sent
Request Service Sent
Status Byte Sent

7.2.1 CHANGING 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.
KLR-DEV 060713 7-3/(7-4 Blank)
Page 90
Page 91

SECTION 8 - RS 232C INTERFACE [STANDARD MODELS ONLY]

8.1 DIGITAL 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.2 RS232-C OPERATION [STANDARD MODELS ONLY]

The KLR Power Supply may be operated via an RS232-C terminal, or from a PC using a termi­nal emulation program. Refer to KLR User Manual for RS 232 connections and default port set­tings.
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.1 RS 232 IMPLEMENTATION [STANDARD MODELS ONLY]

The following paragraphs are provided to help the user understand how the RS 232 serial inter­face is implemented in the KLR Power Supply.
The serial interface behaves like the GPIB interface in that the command is parsed after receiv­ing 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 060713 8-1
Page 92
BS removes the last character in the input buffer queue, with the exception of CR or LF/NL char­acters. 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 char­acters are reserved for LAN communications, and their use in other serial programming proto­cols will likely result in interrupted communications.

8.2.2 DATA 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 communica­tion: 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 hand­shake options (prompt and XON XOFF) the host computer can ensure that the serial data inter­rupts 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.

FIGURE 8-1. RS 232 IMPLEMENTATION [STANDARD MODELS ONLY]

8-2 KLR-DEV 060713
Page 93
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 elec­tronic 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.1 ECHO MODE [STANDARD MODELS ONLY]

Echo mode is the default method of ensuring data is transferred without errors. Each byte (char­acter) 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.2 PROMPT 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.3 XON 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 (transmis­sion 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 nor­mal 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 subse­quent commands.
), and waits until the XON character is
H
KLR-DEV 060713 8-3
Page 94

8.2.2.4 ISOLATING RS 232 COMMUNICATIONS PROBLEMS [STANDARD MODELS ONLY]

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 hard­ware 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-4 KLR-DEV 060713
Page 95

SECTION 9 - LAN INTERFACE [E-Series MODELS ONLY]

9.1 INTRODUCTION

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.2 USING 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.3 USING 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 Name Key Function
1SOH
2STX
3ETX
5 ENQ
12DC2
14DC4
Ctrl A Terminate connection
Ctrl B Execute Trigger, respond with <TRIGGER>
Ctrl C Execute Device clear to unit respond with <DEVICE CLEAR>
Ctrl J or Ctrl M Line Terminator
Ctrl E Unit will respond with the user description of the device.
Ctrl R Lock port
Ctrl T Unlock 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 060713 9-1
Page 96

9.4 USING 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.5 USING 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.6 USING 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.7 SUNRPC 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 sup­ported is the GETPORT.
9-2 KLR-DEV 060713
Page 97

APPENDIX A - IEEE 488.2 COMMAND/QUERY DEFINITIONS

A.1 INTRODUCTION

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.
COMMAND PAR. COMMAND PAR.
*CLS A.2 *RST A.13
*ESE, ? A.3, A.4 *SAV A.13
*ESR? A.5 *SRE, ? A.13, A.14
*IDN? A.6 *STB? A.15
*OPC, ? A.7, A.8 *TRG A.16
*OPT? A.13 *TST? A.17
*RCL A.13 *WAI A.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 Sta­tus Byte Register to be set (1 = set = enable, 0 = reset = disable)
. (See example, Figure A-1.)
TABLE A-2. STANDARD EVENT STATUS ENABLE REGISTER
AND STANDARD EVENT STATUS REGISTER BITS
PON Power On
CONDITION PON NU CME EXE DDE QUE NU OPC
BIT 76543210
VALUE1286432168421
NU (Not Used) CME Command Error EXE Execution Error DDE Device Dependent Error QUE Query Error OPC Operation Complete
KLR-DEV 060713 A-1
Page 98
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 ver­sion.
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-2 KLR-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
RODC = Rapid Output Discharge Circuit option installed
<Manufacturing Data> = DDMMYYYY-Axxxxxx (DD=day, MM=month, and YYYY=year of manu­facture, 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 control­ler then sends *ESR?, the power supply responds with either a “0” (if the power supply is busy execut­ing 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 pro­gram can monitor the bus for data until it receives the “1” from the power supply Output Queue. (See example, Figure A-1.)
KLR-DEV 060713 A-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 avail­able 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 com­mand.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-4 KLR-DEV 060713
Loading...