Microsoft, Visual C++, Excel, and Windows are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.
Document number: 4200A-KULT-907-01 Rev. C March 2023
Safety precaut ions
The following safety precautio ns should be observed before using this product and any associated instrumentation. Although
some instruments and accessories would normally be used with nonhazardous voltages, there are situations where hazardous
conditions may be present.
This product is intended for use by personnel who recogn ize sho ck haz ards and are familiar with the safety precautions required
to avoid possible injury. Read and follow all installation, operation, and maintenance information carefully before using the
product. Refer to the user documentation for complete product specifications.
If the product is used in a manner not specified, the protection provided by the product warranty may be impaired.
The types of product users are:
Responsible body is the individual or group responsible for the use and maintenance of equipment, for ensuring that the
equipment is operated within its specifications and operating limits, and for ensuring that operators are adequately trained.
Operators use the product for its intended function. They must be trained in electrical safety procedures and proper use of the
instrument. They must be protected from electric shock and contact with hazardous live circuits.
Maintenance personnel perform routine procedures on the product to keep it operating properly, for example, setting the line
voltage or replacing consumable materials. Maintenance procedures are described in the user documentation. The procedures
explicitly state if the operator may perform them. Otherwise, they should be performed only by service personnel.
Service personnel are trained to work on live circuits, perform safe installations, and repair products. Only properly trained
service personnel may perform installation and service procedures.
Keithley products are designed for use with electrical signals that are measurement, control, and data I/O connections, with low
transient overvoltages, and must not be directly connected to mains voltage or to voltage sources with high transient
overvoltages. Measurement Category II (as referenced in IEC 60664) connections require protection for high transient
overvoltages often associated with local AC mains connections. Certain Keithley measuring instruments may be connected to
mains. These instruments will be marked as category II or higher.
Unless explicitly allowed in the specifications, operating manual, and instrument labels, do not connect any instrument to mains.
Exercise extreme caution when a shock hazard is present. Lethal voltage may be present on cable connector jacks or test
fixtures. The American National Standards Institute (ANSI) states that a shock hazard exists when voltage levels greater than
30 V RMS, 42.4 V peak, or 60 VDC are present. A good safety practice is to expect that hazardous voltage is present in any
unknown circuit before measuring.
Operators of this product must be protected from electric shock at all times. The responsible body must ensure that operators
are prevented access and/or insulated from every connection point. In some cases, connections must be exposed to potential
human contact. Product operators in these circumstances must be trained to protect themselves from the risk of electric shock. If
the circuit is capable of operating at or above 1000 V, no conductive part of the circuit may be exposed.
Do not connect switching cards directly to unlimited power circuits. They are intended to be used with impedance-limited
sources. NEVER connect switching cards directly to AC mains. When connecting sources to switching cards, install protective
devices to limit fault current and voltage to the card.
Before operating an instrument, ensure that the line cord is connected to a properly-grounded power receptacle. Inspect the
connecting cables, test leads, and jumpers for possible wear, cracks, or breaks before each use.
When installing equipment where access to the main power cord is restricted, such as rack mounting, a separate main input
power disconnect device must be provided in close proximity to the equipment and within easy reach of the operator.
For maximum safety, do not touch the product, test cables, or any other instruments while power is applied to the circuit under
test. ALWAYS remove power from the entire test system and discharge any capacitors before connecting or disconnecting
cables or jumpers, installing or removin g switch ing cards, or making internal changes, such as installing or removing jumpers.
Do not touch any object that could provide a current path to the common side of the circuit under test or power line (earth)
ground. Always make measurements with dry hands while standing on a dry, insulated surface capable of withstanding the
voltage being measured.
For safety, instruments and accessories must be used in accordance with the operating instructions. If the instruments or
accessories are used in a manner not specified in the operating instru cti ons , the prot ect ion provi ded by the equi pm ent ma y be
impaired.
Do not exceed the maximum signal levels of the instruments and accessories. Maximum signal levels are defined in the
specifications and operating information and shown on the instrument panels, test fixture panels, and switching cards.
When fuses are used in a product, replace with the same type and rating for continued protection against fire hazard.
Chassis connections must only be used as shield connections for measuring circuits, NOT as protective earth (safety ground)
connections.
If you are using a test fixture, keep the lid closed while power is applied to the device under test. Safe operation requires the use
of a lid interlock.
If a
The
screw is present, connect it to protective earth (safety ground) using the wire recommended in the user documentation.
symbol on an instrument means caution, risk of hazard. The user must refer to the operating instructions located in the
user documentation in all cases where the symbol is marked on the instrument.
The symbol on an instrument means warning, risk of electric shock. Use standard safety precautions to avoid personal
contact with these voltages.
The
The
If this
symbol on an instrument shows that the surface may be hot. Avoid personal contact to prevent burns.
symbol indicates a connection terminal to the equipment frame.
symbol is on a product, it indicates that mercury is present in the display lamp. Please note that the lamp must be
properly disposed of according to federal, state, and local laws.
The WARNING heading in the user documentation explains hazards that might result in personal injury or death. Always read
the associated information very carefully before performing the indicated procedure.
The CAUTION heading in the user documentation exp lai ns h azards that could damage the instrument. Such damage ma y
invalidate the warranty.
The CAUTION heading with the
symbol in the user documentation explains hazards that could result in moderate or minor
injury or damage the instrument. Always read the associated information very carefully before performing the indicated
procedure. Damage to the instrument may invalidate the warranty.
Instrumentation and accessories shall not be connected to humans.
Before performing any maintenance, disconnect the line cord and all test cables.
To maintain protection from electric shock and fire, replacement components in mains circuits — including the power
transformer, test leads, and input jacks — must be purchased from Keithley. Standard fuses with applic abl e nation al safe ty
approvals may be used if the rating and type are the same. The detachable mains power cord provided with the instrument may
only be replaced with a similarly rated power cord. Other components that are not safety-related may be purcha sed fr om o ther
suppliers as long as they are equivalent to the original component (note that selected parts should be purchased only through
Keithley to maintain accuracy and functionality of the product). If you are unsure about the applicability of a replacement
component, call a Keithley office for information.
Unless otherwise noted in product-specific literature, Keithley instruments are designed to operate indoors only, in the following
environment: Altitude at or below 2,000 m (6,562 ft); temperature 0 °C to 50 °C (32 °F to 122 °F); and pollution degree 1 or 2.
To clean an instrument, use a cloth dampened with deionized water or mild, water-based cleaner. Clean the exterior of the
instrument only. Do not apply cleaner directly to the instrument or allow liquids to enter or spill on the instrument. Products that
consist of a circuit board with no case or chassis (e.g., a data acquisition board for installation into a computer) should never
require cleaning if handled according to instr uc tions. If the board becomes contaminated and operation is affected, the board
should be returned to the factory for proper cleaning/servicing.
Develop and use user libraries ............................................... 1-16
Copy user modules and files .................................................. 1-16
Enabling real-time plotting for UTMs ...................................... 1-17
Introduction
The Keithley User Library Tool (KULT) and the KULT Extension for Visual Studio Code are a few of
the software tools provided with the Keithley Instruments Model 4200A-SCS. The 4200A-SCS is a
customizable and fully integrated par a meter ana lyz er that provides sy nchr on iz ed insig ht into
current-voltage (I-V), capacitance-voltage (C-V), and ultra-fast pulsed I-V characterization. Its
advanced digital sweep parameter analyzer combines speed and accuracy for deep sub-micron
characterization.
The primary 4200A-SCS components and typical supported external components are illustrated in the
following figure.
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
Figure 1: 4200A-SCS summary
KULT description
You can use the Keithley User Library Tool (KULT) and the KULT Extension for Visual Studio Code to
create and manage user libraries. A user library is a collection of user modules. User modules are C
programming language subroutines, also called functions. User libraries are created to control
instrumentation, analyze data, or perform any other system automation task programmatically. Once
a user library has been successfully built using KULT, its user modules can be executed using the
Clarius software tool.
KULT provides a simple user interface that helps you effectively enter code, build a user module, and
build a user library. KULT also provides management features for the user library, including menu
commands to copy modules, copy libraries, delete modules, and delete library menu commands.
KULT manages user libraries in a structured manner. You can create your own user libraries to
extend the capabilities of the 4200A-SCS.
The KULT Extension for Visual Studio Code gives you the ability to write, compile, and debug user
libraries outside of KULT. Combining the user-friendly Visual Studio Code editor with KULT creates
an integrated development environment (IDE).
1-2 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
Introduction
-SCS KULT and KULT Extension Programming Section 1:
To execute a KULT user module in Clarius, you create a Clarius user test module (UTM) and connect
it to the user module. Once this user module is connected to the UTM, the following occurs each time
Clarius executes the UTM:
• Clarius dynamically loads the user module and the appropriate user library directory (usrlib).
• Clarius passes the user-module parameters (stored in the UTM) to the user module.
• Data generated by the user module is returned to the UTM for interactive analysis.
KULT interface description
The KULT interface is shown in the following figure. It provides all the menus, controls, and user-entry
areas that you need to create, edit, view, and build a user library and to create, edit, view, and build a
user module.
Figure 2: KULT interface overview
Each feature of the KULT interface is explai ned in the follow ing sections.
4200A-KULT-907-01 Rev. C March 2023 1-3
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
Module identific ation area
The module identification area is directly below the menu bar and defines the presently open user
library and user module. The components of this area are as follows:
• Library: Displays the name of the presently open (active) user library.
• Module: Displays the name of the presently open user module.
• Return Type: Defines the data type of all codes that are returned by return(code) statements
in the user module. You can select one of the following variable types:
char: Character data
double: Double-precision data
float: Single-precision floating point data
int: Integer data
long: 32-bit integer data
void: No data returned
When a user test module (UTM) is executed by Clarius, the value of the return(code) statement
is displayed on the Data worksheet in the column labeled with the module name.
•Library Visible / Library Hidden: Displays whether or not the presently open user library is
available to Clarius. To change the hidden or visible status, select or clear the Hide Library option
in the Options menu (on page 1-15
).
•Apply: Updates the presently open user module to reflect additions and changes.
Module parameter display area
The module parameter area is a display-only area that is directly below the module identification area.
In the module-parameter area, KULT displays:
•The C-language function prototype for the user module, reflecting the parameters that are
specified in the Parameters tab area, and the return(code) data type.
•The #include and #define statements that are specified in the Includes tab.
1-4 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
troduction
-SCS KULT and KULT Extension Programming Section 1: In
Module code-entry area
The module code-entry area is below the module-parameter area. The module code-entry area is
where you enter, edit, or view the user-module C code. Scroll bars located to the right and below the
module-code entry area let you move through the code.
Do not enter the following C-code items in the module code-entry area (KULT enters these at special
locations based on information in oth er plac es in KULT ): #include and #define statements; the
function prototype; and the terminating brace. To control internal or external instr u ment ati on, us e
functions from the Linear Parametric Test Library (LPTLib). For more information, refer to Model 4200A-SCS LPT Library Program ming.
Terminating brace area
The terminating-brace area is a display-only area. KULT automatically enters and displays the
terminating brace for the user-module code when you select Apply.
Tab area
The Tab area includes the tabs:
• Parameters
• Includes
• Description
• Build
Parameters tab area
In the Parameters tab, you define and display parameters in the user module call. You can define
and display:
• Parameter name
• Parameter data type
• Input or output (I/O) data direction
• Default, min, and max values for the parameter
These options are defined in the following text.
4200A-KULT-907-01 Rev. C March 2023 1-5
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
The Parameters tab area is near the bottom of the KULT main screen. An example is shown here.
Figure 3: Parameters tab for the Rdson42XX user module from the KI42XX library
You can right-click anywhere in the Parameters tab area to access the Add, Delete, and
Apply options.
To add a parameter:
1. Select Add.
2. Enter the information as needed.
To delete a parameter:
1. Select the parameter name or any of the adjacent fields.
2. Select Delete.
3. Select Apply.
To make changes to the parameters:
1. Make changes in the appropriate field.
2. Select Apply.
Parameter name field
The parameter name field identifies the parameters that are passed to the user module. These are
the same parameters that are specified in the user-module function prototype. KULT constructs the
prototype from the Parameters tab entries when you select Apply, and then displays it in the
module-parameter display area.
1-6 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
on
-SCS KULT and KULT Extension Programming Section 1: Introducti
Data type field
The data type field specifies the parameter data type. Select the arrow at the right of the data type
field to choose from a list of the following data types:
• char: Character data
• char*: Pointer to character data
• float: Single-precision floating point data
• float*: Pointer to single-precision floating point data
• double: Double-precision data
• double*: Pointer to double-precision point data
• int: Integer data
• int*: Pointer to integer data
• long: 32-bit integer data
• long*: Pointer to 32-bit integer data
• F_ARRAY_T: Floating point array type
• I_ARRAY_T: Integer array type
• D_ARRAY_T: Double-precision array type
I/O field
The I/O field defines whether the parameter is an input or output type. Select the arrow to the right of
the I/O field to select from the input and output selections.
Default, min, and max fields
The Default field specifies the default value for a nonarray (only) input parameter.
The Min field specifies the minimum recommended value for a nonarray (only) input parameter.
When the user module is used in a Clarius user test module (UTM), configuration of the UTM with a
parameter value smaller than the minimum value causes Clarius to display an out-of-range message.
The Max field specifies the maximum recommended value for a nonarray (only) input parameter.
When the user module is used in a Clarius UTM, configuration of the UTM with a parameter value
larger than the maximum value causes Clarius to display an out-of-range message.
The minimum value must be less than the maximum value.
4200A-KULT-907-01 Rev. C March 2023 1-7
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
Includes tab area
The Includes tab, shown below, lists the header files used in the user module. This area can be used
to add #include and #define statements to the presently open user module.
By default, KULT automatically enters the keithley.h header file into the Includes tab. The
keithley.h header file includes the following frequently used C-programming interfaces:
Figure 4: Default Includes tab area
• #include <stdio.h>
• #include <stdlib.h>
• #include <string.h>
• #include <math.h>
• #include "windows.h"
In most cases, it is not necessary to add items to the Includes tab area, because keithley.h
provides access to the most common C functions. However, in some cases, both of the following
may apply:
• You do not want to include keithley.h
• You want to include only the header files specifically needed by your user module and all the user
modules on which it depends.
If so, you must minimally include the following header files and #define statements to properly build
user modules and user libraries:
-SCS KULT and KULT Extension Programming Section 1:
Description tab area
The Description tab, shown below, allows you to enter descriptive information for the presently open
user module. The information that is entered in this area documents the module to the Clarius user
and is used to create Clarius user library help.
Figure 5: Description tab area
Do not use C-code comment designators (/*, */, or //) in the Description tab area. When the
user-module code is built, KULT also evaluates the text in this area. C-code comment
designators in the Description tab area can be misinterpreted, causing errors.
Do not place a period in the fir st column (the left-most position) of any line in the Desc r iption tab area.
Any text after a first-column period will not be displayed in the documentation area of a Clarius UTM
definition document.
To enter a description:
1. Select in the Description tab area.
2. Enter the description.
3. Right-click in the Description tab area to open the menu shown here.
Figure 6: Edit menu for the Description tab area
4200A-KULT-907-01 Rev. C March 2023 1-9
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
The edit menu commands are:
•New: Deletes the present description from the description tab area, allowing you to enter a new
description.
•Include: Imports any file that you specify, typically a text file, into the document tab area. Refer to
Include (on page 1-10
) for more information.
•Cut: Removes highlighted text from the Description tab and copies it to the clipboard. The text on
the clipboard can be restored to new locations, in or out of KULT, using the paste function.
•Copy: Copies highlighted text from the description tab area to the clipboard. The text on the
clipboard can be placed at new locations, in or out of KULT, us in g the past e funct ion.
• Paste: Places text from the clipboard at a selected location in the Description tab area.
• Select All: Selects everything in the Description tab area.
Include
Imports a *.c file that you specify into the module code-entry area only. This is typically a text file.
The file is imported into the document tab area.
File > Include
The
the source file for a KULT user module
the user module (not only the C code) is importe d. There fo re, you must edit the entered text
to remove all but the needed information. In particular, you must remove any comments of
the form
/* USRLIB MODULE ___*/
In some cases, it is more efficient to copy only the needed code text from the source file, then
paste it into the module code-entry area.
To insert a text or other file into the document tab area, refer to Description tab area (on page 1-9)
for information about the Include menu option.
command inserts everything from the specified file. If the specified file is
<ModuleName.c>
, everything that KULT saves into
.
To import a *.c file:
1. Select Include. The Include Other File dialog opens.
2. Place the cursor where you want to place the new information.
3. Browse and select a file or enter a file name and path.
4. Select Open. The file is inserted at the cursor location.
1-10 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
Introduction
-SCS KULT and KULT Extension Programming Section 1:
Build tab area
The Build tab area displays any error or warning messages that are generated during a code build
operation of the user library. When you select a build error message that is displayed in the Build tab
area, KULT highlights either the line of code where the error occurred or the next line, depending on
how the compiler caught the error. KULT also highlights the error message. This helps you
correct errors.
If no errors are found, the Build tab area displays:
No Errors/Warnings Reported. Compilation/Build was Successful.
Status bar
The status bar at the bottom of the KULT dialog displays a description of the area where the cursor is
located. For example, if the cursor is in the Parameters tab area, the status bar describes that area,
as shown in the following figure.
Figure 7: Example of description in s tatus bar
Menus
This section describes the menus on the menu bar, which is at the top of the KULT dialog.
File menu
All user libraries are stored in the C:\s4200\kiuser\usrlib directory. This directory is referred to
as Clarius/KULT user-library directory. It is the active user-library directory, which is where Clarius
and KULT look for user libraries and user modules.
The File menu includes options to work with libraries.
4200A-KULT-907-01 Rev. C March 2023 1-11
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
New Libr ary
The New Library menu option creates a new user library.
Library names cannot start with a number.
To create a new user library:
1. Select New Library. The Enter library dialog opens.
2. Name the new user library.
Open Library
3. Select OK. This initializes and opens the new user library in place of the presently open library.
Opens an existing user library in place of the presently open library.
To open a library:
1. Select Open Library to display the open library list.
2. Select an existing user library.
3. Select OK to open the selected library.
Copy Library
Creates a copy of the presently open user library.
To copy a library:
1. Select Copy Library. The Enter Library dialog opens.
2. Name the new user library into which to copy the presently open library.
3. Select OK to copy the open user library into the new library.
Delete Library
Deletes an existing user library and all its contents.
To delete a library:
1. Select Delete Library. The list of libraries is displayed.
2. Select the user library to be deleted.
1-12 4200A-KULT-907-01 Rev. C March 2023
3. Select OK to delete the selected library.
Model 4200A
Introduction
New Module
-SCS KULT and KULT Extension Programming Section 1:
This option creates a new user module. When you create a new user module, existing module
information in the KULT interfac e is cleared.
The name of the new module must not duplicate the name of any existing user module or user library
in the entire collection of user libraries.
To create a new user module:
1. Select New Module.
2. Enter a new user-modu le name in Mod ul e.
Open Module
3. Select Apply.
Opens an existing user module.
To open a module:
1. Select Open Module. The Open Module list is displayed.
2. Select an existing user module.
3. Select OK to open the selected module in place of the presently open module.
Save Module
Saves the open user module.
Copy Module
Creates a copy of the open user module.
The name of the new module must not duplicate the name of any existing user module or user library
in the entire collection of user libraries.
To copy the user module:
1. Select Copy Module. The list of libraries opens.
2. Select the user library in which to copy the presently open user module.
3. Select OK. The Enter New Module dialog opens.
4. Enter a unique user-module name.
5. Select OK. The presently open module is copied into the selected library under the new name.
The presently open module remains open.
4200A-KULT-907-01 Rev. C March 2023 1-13
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
Delete Module
Deletes a user module from the open user library.
To delete a user module:
1. Select Delete Module. The KULT: Library [OpenLibraryName] list is displayed.
2. Select the module to be deleted.
3. Select OK. The selected module is deleted. The open module continues to be displayed, even if it
The executable user-library file, a dynamic link library (DLL), contains the deleted module until you
rebuild the library. Refer to Building the user library to include the new user module (on page 2-9
more information.
Print Module
is the module that you deleted.
) for
Exit
Edit menu
Prints a text file that contains all the information for the presently open user module. The text file is
arranged in the form that KULT uses internally.
Exits KULT.
The Edit menu contains typical Microsoft® Windows® editing commands.
Edit menu commands:
•Cut: Removes highlighted text and copies it to the clipboard. The text on the clipboard can be
restored to new locations, in or out of KULT, using the paste function.
•Copy: Copies highlighted text to the clipboard. The text on the clipboard can be placed at new
locations, in or out of KULT, using the paste function.
• Paste: Places the text from the clipboard to a selected location.
• Select All: Selects everything in the module code-entry area.
• Undo: Allows you to reverse up to the last ten changes made in the module code-entry area.
• Redo: Allows you to reverse up to the last ten undo operations in the module code-entry area.
1-14 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
Introduction
-SCS KULT and KULT Extension Programming Section 1:
Options menu
The KULT Options menu is shown here.
Options menu commands:
•Build Library: When selected, adds the open user module (or updates changes) to the open
user library. All the modules in the open user library and any libraries on which the open module
depends are linked together. A dynamic link library (DLL) is created that is accessible using user
test modules (UTMs) in Clarius.
Figure 8: KULT Options menu
Some Keithley Instruments-supplied user libraries contain dependencies. If you need to build or
rebuild such libraries, be sure that you specify the dependencies in the dialog opened by Options > Library Dependencies. For more information, refer to descriptions in the following and to details in
the Dependent user modules and user libraries (on page 3-9
).
Otherwise, the Build Library function will fail. For example, ki82ulib depends on KI590ulib and
Winulib. You must specify these dependencies before rebuilding ki82ulib after making changes.
•Hide Library: When selected, causes the present user library to be unavailable to Clarius. For
example, use Hide Library if you want to designate that a user library is only to be called by
another user library and is not to be connected to a UTM.
•Library Dependencies: When selected, displays the Library Dependencies list, where you
specify each user library that is called by and that must be linked to the open user library. You
must make selections individually; do not hold down the control or shift key to make
multiple selections.
The C:\s4200\kiuser\usrlib\<library name>\build folder is created when you run the
bld_lib subcommand or select the Build Library menu option. This folder can be safely deleted
for debugging purposes.
4200A-KULT-907-01 Rev. C March 2023 1-15
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
Help menu
The Help menu contains online help information about KULT:
•Contents: Allows access to the online KULT manual and other 4200A-SCS reference
information.
•About KULT: Displays the software version.
Develop and use user libraries
Clarius includes user libraries of user modules that contain precoded user modules for commonly
used external instru ments . You can use thes e as -is, customize them, or create new ones. Most user
modules contain functions from the Keithley-supplied Linear Parametric Test Library (LPT Library)
and ANSI-C functions. All user modules are created and built using KULT.
Additionally, using KULT, you can program custom user modules in C. The LPT Library contains
functions that are designed for parametric tests. However, any C routine that can be built using KULT
can be used as source code for a user module.
A user library is a dynamic link library (DLL) of user modules that are built and linked using the
Keithley User Library Tool (KULT).
A user module is a C-language function that:
1. Typically calls functions from the LPT library and ANSI-C functions.
2. Is developed using the Keithley User Library Tool (KULT).
The default collection of KULT user libraries is stored in the directory C:\s4200\kiuser\usrlib.
User library names must not start with a number.
Copy user modules and files
You can use the KULT zip (on page 3-8) and unzip (on page 3-8) subcommands to copy user
libraries and other files. See Perf or ming ot her KULT ta s ks using command-line commands (on
page 3-3) for more information.
The KULTArchive.exe utility is installed on your 4200A-SCS. You can copy this utility to a Model
4200 or 4200A-SCS to archive or unzip a user library for use with an earlier version of Clarius. This
utility is located at C:\S4200\sys\bin\KULTArchive.exe.
If you use the KULTArchive.exe utility with a Model 4200, you must install the Microsoft Visual C++
Redistributable. This file is available on your 4200A-SCS at
C:\s4200\sys\Microsoft\Microsoft Visual C++ 2017
Redistributable\c_redistx86.exe.
1-16 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
Introduction
-SCS KULT and KULT Extension Programming Section 1:
Usage
kultarchive [subcommand]
Where:
<subcommand> is the zip or unzip operation.
KULTArchive zip subcommand
zip -l<library_name> [password] <zipfile_name>
The <library_name> user library is created in the active user-library directory.
The [password] parameter is optional.
Example for zip without password
kultarchive zip -l<Library1> C:\temp\myzip.zipKULTArchive unzip subcommand
unzip [-dest_path] [password] <zipfile_name>
Where:
• [-dest_path] is the target directory where the file will be unzipped.
• [password] is required if the file was compressed using the password parameter in the zip
subcommand.
The <zipfile_name> archive is unzipped in the active user-library directory unless the
[-dest_path] parameter is specified. The [-dest_path] parameter should not be used when
you import a user library.
Example for unzip with passwordkultarchive unzip -password -pw1234 C:\temp\myzip.zip
Enabling real-time plotting for UTMs
To enable real-time plotting in a UTM, you use the following LPT library functions:
• PostDataDouble()
• PostDataInt()
• PostDataString()
In these functions, the first parameter is the variable name, defined as char *.
4200A-KULT-907-01 Rev. C March 2023 1-17
Section
Programming
1: Introduction Model 4200A-SCS KULT and KULT Extension
When using the new functions to transfer data into the data sheet in real time, make sure the data is
already in the memory of the 4200A-SCS. Sweep measurements are not suitable for real-time
transfer because data is not ready until sweep finishes. The following tutorials show how to enable
real-time plotting for a UTM.
For more information on LPT library functions, refer to Model 4200A-SCS LPT Library Program ming.
Using NI-VISA in user libraries
You can use a user library to communicate with an external instrument that is connected using a USB
cable. The library requires the optional NI-VISA installation. To include NI-VISA, a library dependency
to visa32.lib must be added first. This dependency applies to all modules in a library and only
needs to be completed once per library.
Clarius includes two libraries, generic_visa_ulib and the dmm_6500_7510_temp_ulib, as
examples of using VISA commands to communicate with USB controlled instruments.
Add NI-VISA as a library dependency in KULT
To add NI-VISA as a library dependency in KULT:
1. Close KULT.
2. Go to the kitt_src folder for the library, such as
C:\s4200\kiuser\BeepLib\lib_name\kitt_src.
3. Open the .mak file for the library in Notepad or another editor.
4. In the LIBS variable, between the quotes, enter visa32.lib. Enter any other library
dependencies you may need.
5. Save the file.
6. Reopen the library in KULT.
Modifying the library dependencies in KULT will overwrite NI-VISA. To add additional dependencies
without overwriting VISA, repeat the above process.
1-18 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
Introduction
-SCS KULT and KULT Extension Programming Section 1:
Add NI-VISA as a library dependency in the KULT Extension
In addition to the library dependency, all modules that use NI-VISA must also include the visa.h and
visatype.h header files.
To add NI-VISA as a library dependency in the KULT Extension:
1. Select the library in the KULT side bar.
2. In the Miscellaneous pane of the KULT side bar, select the library_name.mak file to open it in
the editor.
3. In the code editor, add the visa32.lib file to the LIBS variable.
4. Save the file.
Include the NI-VISA header files in KULT
To include the NI-VISA header files in KULT:
1. Open the module in KULT.
2. Select the Includes tab at the bottom of the screen.
3. Add the following statements :
#include "visa.h"
#include "visatype.h"
Include the NI-VISA header files in the KULT Extension
To include the NI-VISA header files in the KULT Extension:
1. Open the module in the editor.
2. Under the /* USRLIB MODULE PARAMETER LIST */ comme nt, add the fol lo wing state ments :
#include "visa.h"
#include "visatype.h"
Remove Intellisense errors
If you are using the KULT Extension, including visa.h and visatype.h may cause an Intellisense
error, because the Intellisense configuration file cannot find the path to the header files. This error will
not affect building the library, but you can remove it by editing the c_cpp_properties.json file.
4200A-KULT-907-01 Rev. C March 2023 1-19
Section
Programming
viOpenDefaultRM
Initializes VISA. Must be called before any other VISA command.
viFindRsrc
USB?*
viFindNext
Used to iterate through the returned list of instruments from viFindRsrc to
find an instrument.
viOpen
Opens a session to the instrument specified by the VISA resource string.
viWrite
Writes data to an external instrument.
viRead
Reads a set number of characters as a string from the output buffer of the
external instrument.
viClose
Closes a VISA session. Use this command before exiting a user module.
1: Introduction Model 4200A-SCS KULT and KULT Extension
To remove Intellisense errors caused by the NI-VISA header files:
1. Open the c_cpp_properties.json header file from the Miscel lan eous pan e of the KULT
side bar.
2. In the editor, add the path to the header files:
C:/Program Files (x86)/IVI Foundation/VISA/WinNT/include
Included paths should be enclosed in double quotes and separated by commas.
3. Save the file. This applies to all libraries in the working directory of Visual Studio Code.
NI-VISA commands must be used to communicate with the instrument. These commands are
documented in the NI-VISA Programmer Reference Manual. The most commonly used commands
are shown in the following table.
Commonly used VISA commands
Command Name Description
Finds available instruments and returns a list of their resource strings. The
list can be filtered to USB only using the format string
For more information on VISA command syntax, usage, and error codes, refer to the NI-VISA Programmer Reference Manual, available at https://www.ni.com/ (ni.com/
).
1-20 4200A-KULT-907-01 Rev. C March 2023
Tutorial: Creating a user module for stepping or sweeping .... 2-36
Tutorial: Creating a new user library and user module ............. 2-3
Tutorial: Creating a user module that returns data arrays ...... 2-12
Tutorial: Creating a user module that returns data arrays
in real time ............................................................................ 2-18
Tutorial: Calling one user module from within another ........... 2-23
Tutorial: Customizing a user test module (UTM) .................... 2-29
KULT Tutorials
Section 2
KULT tutorials
The tutorials in this section provide step-by-step instructions for accomplishing common tasks with
KULT. The tutorials are summarized here.
Tutorial: Creating a new user library and new user module(on page 2-3
)
• Name a new user library
• Name a new user module
• Enter a return type
• Enter user module code
• Enter parameters
• Enter header files
• Document the user module
• Save the user module
• Build the user module
• Find code errors
• Build the user library to include the new user module
• Find build errors
• Check the user module
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Tutorial: Creating a user module that returns data arrays(on page 2-12)
• Name a new user library and new VSweep user module
• Enter the VSweep user-module return type
• Enter the VSweep user-module code
• Enter the VSweep user-module parameters
• Enter the VSweep user-module header files
• Document the VSweep user module
• Save the VSweep user module
• Build the VSweep user module
• Check the VSweep user module
Tutorial: Creating a user module that returns data arrays in real time(on page 2-18
)
• Name a new user library and new VSweepRT user module
• Enter the VSweepRT user-module return type
• Enter the VSweepRT user-module code
• Enter the VSweepRT user-module parameters
• Enter the VSweepRT user-module header files
• Document the VSweepRT user module
• Save the VSweepRT user module
• Build the VSweepRT user module
• Check the VSweepRT user module
Tutorial: Calling one user module from with in another(on page 2-23)
• Create the VSweepBeep user module by copying an existing user module
• Call an independent user module from the VSweepBeep user module
• Specify user library dependencies in the VSweepBeep user module
• Build the VSweepBeep user module
• Check the VSweepBeep user module
Tutorial: Customizing a user test module (UTM)(on page 2-29
Tutorial: Creating a user module for stepping or sweeping (on page 2-36)
2-2 4200A-KULT-907-01 Rev. C March 2023
)
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Tutorial: Creating a new user library and user module
KULT is a tool that helps you develop user libraries. Each user library is comprised of one or more
user modules. Each user module is created using the C programming language.
This section contains a tutorial that shows you how to create a new user library and new user module.
A hands-on example is provided that illustrates how to create a user library that contains a user
module that activates the internal beeper of the 4200A-SCS.
Starting KULT
To start KULT:
1. Select KULT in the Microsoft
2. A blank KULT dialog appears named KULT: Module "NoName" Library "NoName", as shown in
the following figure.
®
Windows® Start menu (Start > Keithley Instruments > KULT).
Figure 9: Blank KULT dialog
4200A-KULT-907-01 Rev. C March 2023 2-3
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Naming a new user library
User library names cannot start with a number and cannot contain spaces.
To name a new user library:
1. In KULT, select File > New Library.
2. Enter the new user library name. For this tutorial, enter my_1st_lib.
3. Select OK.
The dialog name changes to KULT: Module "NoName" Library "my_1st_lib", and the name
next to library in the top left of the dialog is now my_1st_lib, as shown in the following figure.
Figure 10: KULT after naming a user l ibrary
Creating a new user module
When naming a user module, conform to case-sensitive C programming language naming
conventions. Do not duplicate names of existing user modules or user libraries.
To create a new user module:
1. Select File > New Module.
2. In the Module text box at the top of the KULT dialog, enter the new user module name. For this
tutorial, enter TwoTonesTwice as the new user module name.
3. Select Apply.
The KULT dialog changes as follows:
•The name of the dialog changes to KULT: Module "TwoTonesTwice.c" Library
"my_1st_lib".
•You see entries in the user-module parameters display area and in the terminating-brace display.
If you select the Includes tab, there is also an entry there, as shown in the following figure.
2-4 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 11: KULT after naming a user module
To view the entire module parameter display area, use the scroll bar.
Entering the return type
If your user module generates a return value, select the data type for the return value in the Return
Type box. The TwoTonesTwice user module does not produce a return value, so keep the void
default entry.
4200A-KULT-907-01 Rev. C March 2023 2-5
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Entering user module code
Enter the C language code.
Refer to Model 4200A-SCS LPT Library Programming for a complete list of supported I/O and
SMU commands.
To enter the C code, enter the new C code into the module-code entry area.
For the TwoTonesTwice user module, enter the code listed below. The code deliberately contains a
missing ; error to illustrate KULT debug capability.
/* Beeps four times at two alternating user-settable frequencies. */
/* Makes use of Windows Beep (frequency, duration) function. */
/* Frequency of beep is long integer, in units of Hz. */
/* Duration of beep is long integer, in units of milliseconds. */
Beep(Freq1, 500); /* Beep at first frequency for 500 ms */
Beep(Freq2, 500); /* Beep at second frequency */
Beep(Freq1, 500);
Beep(Freq2, 500);
Sleep(500) /* NOTE deliberately leave out semicolon */
Entering parameters
To enter the required parameters for the code:
1. Select the Parameters tab.
2. Select Add at the right side of the parameters tab area.
3. Under Parameter Name, enter Freq1.
4. Select the Data Type cell and select long, as shown here. This is the C data type.
5. For this user module, the I/O selection of Input is correct. If the Data Type is a pointer or array,
you could choose Input or Output.
Figure 12: Data Type menu
6. Under Default, Min, and Max, enter default, minimum, and maximum values. These values limit
the choices the user sees. For the TwoTonesTwice user module, enter 1000, 800, and 1200.
2-6 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
7. For the TwoTonesTwice module, add one more parameter with the values:
Parameter name:Freq2
Data type: long
I/O: Input
Default:400
Min:300
Max:500
8. Select Apply. (The Apply buttons at the top and bottom of the dialog act identically.)
Figure 13: Parameter entries for the TwoTonesTwice user module
For an output parameter, only the following data types are acceptable: pointers (such as char*, float*,
and double) and arrays (I_ARRAY_T, F_ARRAY_T, or D_ARRAY_T).
Entering header files
To enter the header files:
1. Select the Includes tab at the bottom of the dialog.
2. Enter any additional header files that are needed by the user module. No additional header files
are needed for the TwoTonesTwice user module or for any of the user libraries supplied by
Keithley Instruments.
Figure 14: Default Includes tab area
3. Select Apply.
4200A-KULT-907-01 Rev. C March 2023 2-7
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Documenting the user module
To document the user module:
1. Select the Description tab at the bottom of the dialog.
Do not use C-code comment designators (/*, */, or //) in the Description tab area. When the
user-module code is built, KULT also evaluates the text in this area. C-code comment
designators in the Description tab area can be misinterpreted, causing errors.
2. Enter any text needed to adequately document the user module to the Clarius user.
Do not place a period in the first column (the left-most position) of any line in the Des c riptio n tab area.
Any text after a first-column period will not be displayed in the documentation area of a Clarius UTM
definition document.
3. For the TwoTonesTwice user module, copy the following information into the Description tab:
----------Execution results in sounding of four beeps at two alternating user-settable
frequencies. Each beeps sounds for 500 ms.
INPUTS
-----Freq1 (double) is the frequency, in Hz, of the first and third beep.
Freq2 (double) is the frequency, in Hz, of the second and fourth beep.
OUTPUTS
------None
RETURN VALUES
------------None
2-8 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 15: Description tab ar ea
Saving the user module
Select the File menu, then select Save Module.
Building the user library to include the new user module
Build the user library to include the module.
To build the user library:
1. Select the Build tab.
2. From the Options menu, select Build Library. The following occurs:
The user library is built. All the user modules in the presently open user library and any
libraries on which the presently open user module depends are linked together.
A DLL is created that is accessible using UTMs in Clarius.
The KULT Build Library message box indicates the build progress. If problems are
encountered, this message box displays error messages. When you build the
TwoTonesTwice user module, you should see an error.
4200A-KULT-907-01 Rev. C March 2023 2-9
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Finding build errors
To find code errors for the TwoTonesTwice user module:
1. Review the error in the Build tab.
Figure 16: Find a code error
2. Add the missing semicolon at the end of the code [Sleep(500);] and delete the comment about
the missing semicolon.
3. Select File > Save Module.
4. Select Options > Build Library.
The KULT Build message box should now display no error messages.
The Build tab area should display “No errors or warnings reported: Library was
successfully built.”
2-10 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Checking the user module
To check a user module, you need to create and execute a user test module (UTM) in Clarius. Create
a simple Clarius project to check the user module.
To check the user module in Clarius:
1. Start Clarius. If Clarius is already running, restart it.
2. Choose the Select pane.
3. Select the Projects tab.
4. Select New Project.
5. Select Create. You are prompted to replace the existing project.
6. Select Yes.
7. Select Rename.
8. Enter UserModCheck and press Enter.
9. Choose Select.
10. Select the Actions tab.
11. Drag Custom Action to the project tree. The action has a red triangle next to it to indicate that it
is not configured.
12. Select Rename.
13. Enter 2tones_twice_chk and press Enter.
14. Select Configure.
15. In the Test Settings pane, select the my_1st_lib user library.
16. From the User Modules list, select the TwoTonesTwice user module. A group of parameters are
displayed for the UTM as shown in the following figure. Accept the default parameters for now.
You can experiment later after you establish that the user module executes correctly.
Figure 17: Configured UTM
17. Select Help to verify that the HTML in the Description tab is correctly formatted. An example is
shown in the following figure.
4200A-KULT-907-01 Rev. C March 2023 2-11
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Figure 18: Example of help formatted as HTML for a user module
18. Select Save.
19. Execute the UTM by selecting Run. You should hear a sequence of four tones, sounded at
alternating frequencies.
This tutorial generates no data. For an example of numerical data, see
Tutorial: Creating a user
module that returns data arrays(on page 2-12).
Tutorial: Creating a user modul e th at returns data arrays
This section provides a tutorial that helps you use array variables in KULT. It also illustrates the use of
return types (or codes), and the use of two functions from the Keithley Linear Parametric Test
Library (LPTLib).
Most of the basic steps that were detailed in Tutorial: Creating a new user library and user module
(on page 2-3) are abbreviated in this tutorial.
2-12 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Naming new user library and new VSweep user module
To name new user library and new VSweep user module:
1. Start KULT.
2. Select File > New Library.
3. In the Enter Library dialog that appears, enter my_2nd_lib as the new user library name.
4. Select OK.
5. Select File > New Module.
6. In the Module text box at the top of the KULT dialog, enter VSweep as the new module name.
7. Select Apply.
Entering the VSweep user-module return type
Select int from the Return Type list. This configures the VSweep user module to generate an integer
return value.
Entering the VSweep user-module code
In the module code-entry area, enter the C code below for the VSweep user module. Open the KULT
dialog to full screen view to simplify code entry.
/* VSweep module
-------------Sweeps through specified V range & measures I, using specified number of points.
Places forced voltage & measured current values (Vforce and Imeas) in output arrays.
NOTE For n increments, specify n+1 array size (for both NumIPoints and NumVPoints).
*/
double vstep, v; /* Declaration of module internal variables. */
int i;
if ( (Vstart == Vstop) ) /* Stops execution and returns -1 if */
return( -1 ); /* sweep range is zero. */
if ( (NumIPoints != NumVPoints) ) /* Stops execution and returns -2 if */
return( -2 ); /* V and I array sizes do not match. */
for(i=0, v = Vstart; i < NumIPoints; i++) /* Loops through specified number of */
/* points. */
{
forcev(SMU1, v); /* LPTLib function forceX, which forces a V or I. */
measi(SMU1, &Imeas[i]); /* LPTLib function measX, which measures a V or I. */
/* Be sure to specify the *address* of the array. */
Vforce[i] = v; /* Returns Vforce array for display in UTM Sheet. */
v = v + vstep; /* Increments the forced voltage. */
}
return( 0 ); /* Returns zero if execution Ok.*/
4200A-KULT-907-01 Rev. C March 2023 2-13
Section
Programming
Vstart
double
Input
0
−200
200
Vstop
double
Input
5
−200
200
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Entering the VSweep user-module parameters
This example uses the double-precision D_ARRAY_T array type. The D_ARRAY_T, I_ARRAY_T, and
F_ARRAY_T are special array types that are unique to KULT. For each of these array types, you
cannot enter values in the Default, Min, and Max fields. On the scroll bar in the Parameters tab area,
there is a space below the slider. This space indicates a hidden fourth line of incomplete parameter
information for the array-size parameter specification.
When executing the Vsweep user module in a UTM, the start and stop voltages (Vstart and Vstop)
must differ. Otherwise, the first return statement in the code halts execution and returns an error
number (-1). When a user module is executed using a Clarius UTM, this return code is stored in the
UTM Data worksheet. The return code is stored in a column that is labeled with the
user-module name.
To enter the required parameters for the code:
1. Select the Parameters tab.
2. Enter the information for the two voltage input parameters, as shown in the following table. Select
the Add button before adding each new parameter.
Parameter name Data type I/O Default Min Max
3. Select Add.
4. Enter the following measured-current parameter information:
5. Scroll down to display line 4 of the Parameters tab area. KULT enters the array size parameter in
this line automatically for the array that is specified on line 3, as shown in the following figure.
Figure 19: KULT-entered array-size parameters
2-14 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
6. Under Parameter Name, change ArrSizeForParm3 to NumIPoints. The default Parameter
Name entry is only a description of the required array size parameter. You must replace it with an
appropriate array size parameter, as required by the user module code.
7. Leave the Data Type and I/O entries as is.
8. Under Default, enter the number 11 for the default current-array size. You can also add Min and
Max array sizes if needed.
9. Select Add.
10. Enter the following forced-voltage parameter informat io n:
11. Under Parameter Name, change ArrSizeForParm5to NumVPoints.
12. Under Default, enter the number 11 for the default voltage array size.
When executing the VSweep user module in a UTM, the current and voltage array sizes must match;
NumIPoints must equal NumVPoints. If the sizes do not match, the second return statement in the
code halts execution and returns an error number (-2) in the VSweep column of the UTM
Data worksheet.
13. Select Apply. In the module-parameter display area, the function prototype now includes the
declared parameters, as shown in the following figure.
4200A-KULT-907-01 Rev. C March 2023 2-15
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Figure 20: VSweep user-module dialog after entering and applying code and parameters
Entering the VSweep user-module header files
You do not need to enter any header files for the VSweep user module. The default keithley.h
header file is sufficient.
Documenting the VSweep user module
Select the Description tab and enter documentation for the user module, based on the comments
provided in the code and other information about the module.
Saving the VSweep user module
From the File menu, select Save Module.
2-16 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Building the VSweep user module
To build the user module:
1. Select the Build tab at the bottom of the dialog to open the Build tab area.
2. In the Options menu, select Build Library. The user library builds. You should not see error
messages.
If you do see error messages, check for typographic errors, then fix and rebuild the user module. If
necessary, review Fi nd ing build er ror s (on page 2-10
Checking the VSweep user module
Check the user module by creating and executing a UTM in Clarius.
To check the user module:
1. Connect a 1 kΩ resistor between the FORCE terminal of the ground unit (GNDU) and the FORCE
terminal of SMU1.
).
2. Instead of creating a new project, reuse the UserModCheck project that you created in
Creating a new user library and user module (on page 2-3).
3. Choose Select.
4. Select the Devices tab.
5. Select the 2-wire-resistor.
6. Choose Select.
7. Select the Tests tab.
8. For the Custom Test, select Choose a test from the pre-programmed library (UTM).
9. Drag Custom Test to the project tree. The test has a red triangle next to it to indicate that it is not
configured.
10. Select Rename.
11. Enter the name v_sweep_chk. You will use this UTM test to execute the VSweep user module.
12. Select Configure.
13. In the right pane Test Settings tab, from the User Libraries list, select my_2nd_lib.
14. From the User Modules list, select the Vsweep user module. A default schemat ic and group of
parameters are displayed for the UTM.
15. For Vstart, enter the sweep values.
16. Select Run.
Tutorial:
17. Select Analyze.
4200A-KULT-907-01 Rev. C March 2023 2-17
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
At the conclusion of execution, review the results in the Analyze sheet. If you connected a 1 kΩ
resistor between SMU1 and GNDU, used the default UTM parameter values, and executed the UTM
successfully, the results should be similar to the results in the following figure. The current/voltage
ratio for each row of results should be approximately 1 mA / V.
In the example in the following figure, a code of 0 is returned. This means that the user module
executed with no errors.
Figure 21: Checking the VSweep user module
Tutorial: Creat ing a user module that returns data arrays in
real time
This tutorial helps you use array variables in KULT and return real-time data. It also illustrates the use
of return types (or codes), and the use of two functions from the Keithley Linear Parametric Test
Library (LPTLib).
The steps that were detailed in Tutorial: Creating a new user library and user module (on page 2-3)
are abbreviated in this tutorial.
To start this tutorial, go to Naming new user library and new VSweep user module (on page 2-19).
2-18 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Naming new user library and new VSweepRT user module
To name new user library and new VSweep user module:
1. Start KULT.
2. Select File > New Library.
3. In the Enter Library dialog that appears, enter my_2nd_lib as the new user library name.
4. Select OK.
5. Select File > New Module.
6. In the Module text box at the top of the KULT dialog, enter VSweepRT as the new module name.
7. Select Apply.
Entering the VSweepRT user-module return type
Select int from the Return Type list. This configures the VSweepRT user module to generate an
integer return value.
Entering the VSweepRT user-module code
In the module code-entry area, enter the C code below for the VSweep user module. To simplify code
entry, open the KULT dialog to full screen view.
/* VSweep module
-------------Sweeps through specified V range & measures I, using specified number of points.
Places forced voltage & measured current values (Vforce and Imeas) in output arrays.
*/
double vstep, v; /* Declaration of module internal variables. */
int i;
if ( (Vstart == Vstop) ) /* Stops execution and returns -1 if */
return( -1 ); /* sweep range is zero. */
for(i=0, v = Vstart; i < NumVPoints; i++) /* Loops through specified number of */
/* points. */
{
forcev(SMU1, v); /* LPTLib function forceX, which forces a V or I. */
measi(SMU1, Imeas); /* LPTLib function measX, which measures a V or I. */
PostDataDouble("Vforce", v); /* Returns Vforce for display in UTM Sheet. */
v = v + vstep; /* Increments the forced voltage. */
}
return( 0 ); /* Returns zero if execution is OK. */
4200A-KULT-907-01 Rev. C March 2023 2-19
Section
Programming
Vstart
double
Input
0
−200
200
Vstop
double
Input
5
−200
200
NumVPoints
int
Input
50 2 65535
Vforce
double *
Output
— — —
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Entering the VSweepRT user-module parameters
This example uses the double-precision D_ARRAY_T array type. The D_ARRAY_T, I_ARRAY_T, and
F_ARRAY_T are special array types that are unique to KULT. For each of these array types, you
cannot enter values in the Default, Min, and Max fiel d s .
When executing the Vsweep user module in a UTM, the start and stop voltages (Vstart and Vstop)
must differ. Otherwise, the first return statement in the code halts execution and returns an error
number (−1). When a user module is executed using a Clarius UTM, this return code is stored in the
UTM Data worksheet. The return code is stored in a column that is labeled with the
user-module name.
To enter the parameters for the code:
1. Select the Parameters tab.
2. Enter the information for the two voltage input parameters, as shown in the following table. Select
the Add button before adding each new parameter.
Parameter name Data type I/O Default Min Max
Imeas double * Output — — —
3. Select Apply. In the Parameters tab, the function prototype now includes the declared
parameters, as shown in the following figure.
2-20 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 22: VSweepRT user-module dialog after entering and applying code and parameters
Entering the VSweepRT user-module header files
You do not need to enter any header files for the VSweepRT user module. The default keithley.h
header file is sufficient.
Documenting the VSweepRT user module
Select the Description tab and enter documentation for the user module, based on the comments
provided in the code and other information about the module.
Saving the VSweepRT user module
From the File menu, select Save Module.
4200A-KULT-907-01 Rev. C March 2023 2-21
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Building the VSweepRT user module
To build the user module:
1. Select the Build tab at the bottom of the dialog to open the Build tab area.
2. In the Options menu, select Build Library. You should not see error messages.
If you do see error messages, check for typographic errors, then fix and rebuild the user module. If
necessary, review Fi nd ing build er ror s (on page 2-10
Checking the VSweepRT user module
Check the user module by creating and executing a UTM in Clarius.
To check the user module:
1. Connect a 1 kΩ resistor between the FORCE terminal of the ground unit (GNDU) and the FORCE
terminal of SMU1.
).
2. Instead of creating a new project, reuse the UserModCheck project that you created in
Creating a new user library and user module (on page 2-3).
3. Choose Select.
4. Select the Devices tab.
5. Select the 2-wire-resistor.
6. Choose Select.
7. Select the Tests tab.
8. For the Custom Test, select Choose a test from the pre-programmed library (UTM).
9. Drag Custom Test to the project tree. The test has a red triangle next to it to indicate that it is not
configured.
10. Select Rename.
11. Enter the name v_sweepRT_chk. You will use this UTM test to execute the VSweepRT user
module.
12. Select Configure.
13. In the right pane Test Settings tab, from the User Libraries list, select my_2nd_lib.
14. From the User Modules list, select the VsweepRT user module. A default schematic and group of
parameters are displayed for the UTM.
15. For Vstart, enter the sweep values.
Tutorial:
16. Select Run.
17. Select Analyze.
2-22 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
At the conclusion of execution, review the results in the Analyze sheet. If you connected a 1 kΩ
resistor between SMU1 and GNDU, used the default UTM parameter values, and executed the UTM
successfully, the results should be similar to the results in the following figure. The current/voltage
ratio for each row of results should be approximately 1 mA / V.
In the example in the following figure, a code of 0 is returned. This means that the user module
executed with no errors.
Figure 23: Checking the VSweep user module
Tutorial: Calling one user module from within another
KULT allows a user module to call other user modules. A called user module may be in the same
user library as the calling module or may be in another user library. This section provides a brief
tutorial that illustrates application of such dependencies. It also illustrates the File > Copy Module command.
In this tutorial, you create a new user module using two user modules that were created in the
previous tutorials: Creating a new user library and user module (on page 2-3) and
module that returns data arrays(on page 2-12):
•The VSweep user module in the my_2nd_lib user library, a copy of which is used as the
dependent user library.
•The TwoTonesTwice user module, in the my_1st_lib user library, which is the independent
user library that will be called by the VSweep user module.
A copy of the VSweep user module, called VSweepBeep, calls the TwoTonesTwice user module to
signal the end of execution.
Creating a user
4200A-KULT-907-01 Rev. C March 2023 2-23
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Creating the VSweepBeep user module by copying an existing
user module
Open the Vsweep user module:
1. Start KULT.
2. Select File > Open Library.
3. Select my_2nd_lib from the list.
4. Select OK.
5. Select File > Open Module.
6. Select VSweep.c from the list.
7. Select OK.
Copy VSweep.c to the new user module VSweepBeep:
1. Select File > Copy Module. The Copy Module list shown in the following figure opens.
Figure 24: Copy Module list
2. Select my_2nd_lib (in this case, the user library for the copy is the same as the user library for
the source).
3. Select OK. The Enter New Module dialog opens, as shown here.
2-24 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 25: Enter New Module dia log
4. Enter the name VSweepBeep.
5. Select OK.
The name of the user module must not duplicate the name of any existing user module or user
library in the entire collection of user libraries.
More than one collection of user libraries can be maintained and accessed, each collection residing
in a separate usrlib. However, only one usrlib can be active at a time. For more information,
refer to the Managing user libraries (on page 3-1
).
KULT creates a copy of the user module under the new name and displays a message indicating the
need to rebuild the user library. You can skip the rebuild for now. Continue with the next step.
Open the new VSweepBeep user module:
1. Select File > Open Module.
2. Select VSweepBeep.c from the list. The KULT dialog displays the VSweepBeep user module.
You can also create a copy of the presently open user module in the same user library as follows:
1. Enter a new name in the User Module text box.
2. Select Apply. Before using the user module, you must save and rebuild the user library.
4200A-KULT-907-01 Rev. C March 2023 2-25
Section
Programming
Freq1
long
Input
1000
800
1200
Freq2
long
Input
400
300
500
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Calling independent user module from VSweepBeep user module
To call the TwoTonesTwice user module at the end of the VSweepBeep user module:
1. At the end of VSweepBeep, immediately before the return(0) statement, add the
following statement:
TwoTonesTwice(Freq1, Freq2); /* Beeps 4X at end of sweep. */
2. In the Parameters tab area, add the Freq1 and Freq2 parameters with the values shown in the
following table, as you did when you created the TwoTonesTwice user module, changing the
Default, Min, and Max values as needed.
Parameter entries for the called user module, TwoTonesTwice
Parameter name Data type I/O Default Min Max
3. Select Apply. The Freq1 and Freq2 parameters are added to the function prototype as shown in
the following figure.
Figure 26: Completed VSweepBe ep user module
2-26 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Specifying user library dependencies in VSweepBeep
user module
Before building the presently open user module, you must specify all user libraries on which the user
module depends (the other user libraries that contain user modules that are called).
The VSweepBeep user module depends on the my_1st_lib user library.
To specify this dependency:
1. In the Options menu, select Library Dependencies. The Library Dependencies list opens, as
shown here.
Figure 27: Library Dependencies list
In general, in the Library Dependencies list box, select all user libraries on which the presently
open user module depends (each selection toggles on and off). For the VSweepBeep module,
select my_1st_lib.
2. Select Apply.
4200A-KULT-907-01 Rev. C March 2023 2-27
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Building the VSweep user module
To build the VSweepBeep user module:
1. Save the VSweepBeep user module.
2. Select the Build tab at the bottom of the dialog to open the Build tab area.
3. In the Options menu, select Build Library. The user library builds. You should not see
error messages.
If you see error messages, check for typographical errors; then fix and rebuild the module. If
necessary, review Fi nd ing build er ror s (on page 2-10
Checking the VSweepBeep user module
Check the user module as you did in the previous tutorials by creating and executing a user test
module (UTM) in Clarius. Refer to Checking the user module (on page 2-11
).
) for details.
This tutorial is almost identical to Tutorial: Creating a user module that returns data arrays (on page
2-12) except that four beeps should sound at the end of execution.
Before proceeding:
1. Connect a 1 kΩ resistor between the FORCE terminal of the GNDU and the FORCE terminal
of SMU1.
2. Instead of creating a new project, reuse the UserModCheck project that you created in
Tutorial:
Creating a new user library and user module (on page 2-3). Add to this project a UTM called
v_sweep_bp_chk.
3. Configure the v_sweep_bp_chk UTM to execute the VSweepBeep user module, which is found
in the my_2nd_lib user library.
4. Run the v_sweep_bp_chk UTM. Near the end of a successful execution, you should hear a
sequence of four tones, sounded at alternating frequencies.
5. At the conclusion of execution, review the results in the Analyze sheet (or the Graph document, if
configured). If you connected a 1 kΩ resistor between SMU1 and GNDU, used the default UTM
parameter values, and executed the UTM successfully, your results should be similar to the
results shown in Checking the VSweep user module (on page 2-17
). The current/voltage ratio for
each row of results should be approximately 1 mA/V.
2-28 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Tutorial: Customizing a user test module (UTM)
This tutorial demonstrates how to modify a user module using KULT. In the ivswitch project, there
is a test named rdson. The rdson test measures the drain-to-source resistance of a saturated
N-channel MOSFET as follows:
1. Applies 2 V to the gate (V
2. Applies 3 V to the drain (V
3. Applies 5 V to the drain (V
) to saturate the MOSFET.
g
) and performs a current measurement (Id1).
d1
) and performs another current measurement (Id2).
d2
Calculates the drain-to-source resistance rdson as follows:
rdson = (V
d2-Vd1
) / (Id2-Id1)
The rdson test has a potential shortcoming. If the drain current is noisy, the two current
measurements may not be representative of the actual drain current. Therefore, the calculated
resistance may be incorrect.
In this example, the user module is modified in KULT so that ten current measurements are made at
and ten more at Vd2. The current readings at Vd1 are averaged to yield Id1, and the current
V
d1
readings at V
are averaged to yield Id2. Using averaged current readings smooths out the noise.
d2
The modified test, rdsonAvg, measures the drain-to-source resistance of a saturated MOSFET. The
MOSFET is tested as follows when rdsonAvg is executed:
1. Applies 2 V to the gate (V
2. Applies 3 V to the drain (V
3. Averages the 10 current readings to yield a single reading (I
4. Applies 5 V to the drain (V
5. Averages the ten current readings to yield a single reading (I
) to saturate the MOSFET.
g
) and makes ten curr ent m eas urem ents .
d1
).
d1
) and makes ten more current measurements.
d2
).
d2
6. Calculates the drain-to-source resistance (rdsonAvg) as follows:
rdsonAvg = (V
d2-Vd1
) / (Id2-Id1)
4200A-KULT-907-01 Rev. C March 2023 2-29
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Open KULT
From the desktop, open the KULT tool by double-clicking the KULT icon. The KULT main dialog is
shown in the following figure.
Figure 28: KULT main dialog
Open the KI42xxulib user library
1. Select File > Open Library.
2. From the Open Library dialog, select KI42xxulib.
2-30 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 29: KULT Open Library dialog
3. Select OK.
Open the Rdson42XX user module
1. From the File menu, select Open Module.
2. From the Open Module dialog, select Rdson42XX.c, as shown in the following figure.
Figure 30: KULT Open Module dialog
3. Select OK. The Rdson42XX module opens.
4200A-KULT-907-01 Rev. C March 2023 2-31
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Copy Rdson42XX to RdsonAvg
You create the new module by copying the Rdson42XX module to a module named RdsonAvg and
then making the appropriate changes to the test module.
When naming a user module, conform to case-sensitive C programming language naming
conventions. Do not duplicate names of existing user modules or user libraries.
To create the new module:
1. From the File menu, select Copy Module.
2. Select the library for the module. From the Copy Module dialog, select KI42xxulib.
3. Select OK.
4. In the Enter New Module dialog, type in RdsonAvg.
Figure 31: Enter New Module Name dialog
5. Select OK. A reminder that the library using the new module needs to be built is displayed.
6. Select OK.
Open and modify the RdsonAvg user module
To open the user module:
1. From the File menu, select Open Module.
2. Select RdsonAvg.c from the Open Module dialog.
The RdsonAvg module is shown in the follow ing figur e.
2-32 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Figure 32: KULT module dialog
Modify the user module code
In the user module code, you need to replace the measi commands with avgi commands. While a
measi command makes a single measurement, an avgi command makes a specified number of
measurements, and then calculates the average reading. For example:
avgi(SMU2, Id1, 10, 0.01);
For the above command, SMU2 makes 10 current measurements and then calculates the average
reading (Id1). The 0.01 parameter is the delay between measurements (10 ms).
The source code for the module is in the module code area of the dialog. In this area, make the
following changes.
Under Force the first point and measure, change the line:
measi(SMU2, Id1);
to
avgi(SMU2, Id1, 10, 0.01); // Make averaged I measurement
4200A-KULT-907-01 Rev. C March 2023 2-33
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Under Force the second point and measure, change the line:
measi(SMU2, Id2);
to
avgi(SMU2, Id2, 10, 0.01); // Make averaged I measurement
In Clarius, any user test modules (UTMs) that are connected to this user module show the text that is
entered on the Description tab in KULT.
To change the module description:
1. Select the Description tab.
2. Above DESCRIPTION, change MODULE: Rdson42xx to MODULE: RdsonAvg, as shown in the
following figure.
3. Replace all occurrences of Rdson with RdsonAvg.
Figure 33: User module description
Save and build the modified library
You must save and also rebuild the library to ensure that the new module is available for use by
Clarius user test modules (UTMs).
2-34 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
To save and build the user module and library:
1. Select File > Save Module.
2. Select Options > Build Library. A dialog is displayed that indicates the build is in process.
Add a new UTM to the ivswitch project
To add rdsonAvg to the ivswitch project:
1. Choose Select.
2. Select Projects.
3. In the Search box, enter ivswitch and select Search. The Library displays the I-V Switch Project
(ivswitch).
4. Select Create. The ivswitch project replaces the previous project in the project tree.
5. Select the Tests tab.
6. For the Custom Test, select Choose a test from the pre-programmed library (UTM).
7. Drag Custom Test to the project tree. The test has a red triangle next to it to indicate that it is not
configured.
8. Select Rename.
9. Enter rdsonAvg and press Enter.
10. In the project tree, drag rdsonAvg to the 4terminal-n-fet device, after the rdson test.
11. Choose Configure.
12. In the Test Settings pane, from the User Libraries list, select KI42xxulib.
13. From the User Modules list, select Rdson42XX.
14. Select Save.
The project tree for the ivswitch project with rdsonAvg added is shown in the following figure.
Figure 34: Project tree with rdson Avg added to 4terminal-n-fet device
4200A-KULT-907-01 Rev. C March 2023 2-35
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Tutorial: Creating a user module for stepping or sweeping
This section provides a tutorial that helps you set up a user test module (UTM) that supports stepping
or sweeping. This example is similar to the vds-id test. For each gate voltage step, the test sweeps
the drain voltage.
Most of the basic steps that were detailed in Tutorial: Creating a new user library and user module
(on page 2-3) are abbreviated in this tutorial. This tutorial adds a user module to the library
my_2nd_lib, which was created in Tutorial: Creating a user module that returns data arrays(
page 2-12).
Name a new user module
To name new user library and new user module:
1. St
art KULT.
on
2. Select File > Open Library.
3. Select my_2nd_lib.
4. Select OK.
5. Select File > New Module.
6. For Module, enter vds_id_step_sweep.
7. Select Apply.
Entering the return type
From the Return Type list, select int. This configures the user module to generate an integer
return value.
2-364200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Entering the user-module code
In the module code-entry area, enter the C language code below for the user module. To simplify
code entry, open the KULT dialog to full-screen view.
int retCode = 0; // This module returns an error or success code to Clarius (shown in
the first column of the data grid).
int stepSteps = 1;
int sweepSteps = 8;
int i = 0;
int j = 0;
int stepperID = 1;
double vg = VgStart;
double stepSimTime = 5000.0; // The time to simulate acquisition of one step data.
double pointDelay = 1.0; // Simulated delay between single data points.
double vd = VdStart;
double id = vd / 1e6; // Simulate id current.
double vgScale = 1.0; // Simulate shift in id data between different steps.
char vgName[32]; // Output names for PostDataDouble data transfer to Clarius.
char vdName[32];
char idName[32];
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Entering the user-module parameters
When the user module is executed in a UTM, the start and stop voltages must differ. Otherwise, the
first return statement in the code halts execution and returns an error number (−1). This return code
is stored in the Analyze sheet for the test, in a column that is labeled with the user-module name.
To enter the parameters for the code:
1. Select the Parameters tab.
2. Enter the information for the two voltage input parameters, as shown in the following table. Select
the Add button before adding each new parameter.
3. Select Apply. In the Parameters tab, the function prototype now includes the declared
parameters, as shown in the following figure.
Figure 35: Parameters for the vds_id_step_sweep user module
2-38 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
Enter the user-module header files
You do not need to enter any header files for the vds_id_step_sweep user module. The default
keithley.h header file is sufficient.
Documenting the user module
Select the Description tab and enter documentation for the user module, based on the comments
provided in the code and other information about the module.
Saving the user module
From the File menu, select Save Module.
Building the user module
To build the user module:
1. Select the Build tab at the bottom of the dialog to open the Build tab area.
2. In the Options menu, select Build Library.
3. Scroll down in the KULT Build Library dialog. You should not see error messages.
4. Select OK.
If you do see error messages, check for typographical errors, then fix and rebuild the user module. If
necessary, review Fi nd ing build er ror s (on page 2-10).
Checking the user module
Check the user module by creating and executing a UTM in Clarius.
This example briefly describes how to edit the UTM user interface in Clarius. For more detail, refer to
“Defining the UTM user interface” in the Model 4200A-SCS Clarius User’s Manual.
To check the user module:
1. Open the UserModCheck project that you created in
user module (on page 2-3).
2. Choose Select.
3. Select Devices.
Tutorial: Creating a new user library
and
4. Select MOSFET, n-type, t terminal (4terminal-n-fet)
5. C
hoose Select.
6. Select the Tests tab.
7. For the Custom Test, select Choose a test from the pre-programmed library (UTM)
4200A-KULT-907-01 Rev. C March 2023 2-39
.
.
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
8. Drag Custom Test to the project tree. The test has a red triangle next to it to indicate that it is not
configured.
9. Select Rename.
10. Enter the name vds_id_step_sweep. Use this UTM test to execute the new user module.
11. Select Configure.
12. In the right pane Test Settings tab, from the User Libraries list, select my_2nd_lib.
13. From the User Modules list, select the vds_id_step_sweep user module. A default schematic
and group of parameters are displayed for the UTM.
14. Make sure the UTM UI Editor is enabled. See “Allow access to the UTM UI editor” in the Model 4200A-SCS Clarius User’s Manual.
15. Right-click in the Configure pane to display the Edit UTM UI button, shown in the following figure.
19. Set the Group Position to Clarius Central Pane and 9 o'clock.
2-40 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT tutorials
-SCS KULT and KULT Extension Programming Section 2:
20. Remove the VdStart, VdStop, and VdStep parameters from this group.
Figure 38: Vg Stepper group in the UTM UI Editor
21. Under Groups, select Add.
22. In Group Name, enter Vd Sweeper.
23. Set the Group Position to Clarius Central Pane and 3 o'clock.
24. Add the VdStart, VdStop, and VdStep parameters to this group.
Figure 39: Vd Sweeper group in the UTM UI Editor
25. Select Advanced Settings. The UTM UI Advanced Settings dialog allows you to select
parameters that are used as UTM stepper Start, Stop, and Step values. This information is
required for Clarius to manage data coming from the user module while running the UTM.
26. For Start, select VgStart.
27. For Stop, select VgStop.
28. For Step, select VgStep.
29. Select OK.
4200A-KULT-907-01 Rev. C March 2023 2-41
Section
Programming
2: KULT tutorials Model 4200A-SCS KULT and KULT Extension
Figure 40: Edit UTM UI for a stepper
30. Select OK. Configure shows the new groups.
Figure 41: vds_id_step_sweep in Configure
31. Select Run.
32. Select Analyze to review the results. Each output parameter is repeated based on the number
of steps.
Managing user libraries ............................................................ 3-1
Dependent user modules and user librarie s ............................. 3-9
Formatting user module help for the Clarius Help pane ......... 3-13
Introduction
Additional features of KULT include:
Section 3
User module and library management
• Tools to manage user libraries (on page 3-1)
• Dependent user modules and user libr ar ies (on page 3-9)
• Ability to format user module help for the Clarius Help pane (on page 3-13)
• Ability to create project prompts (on page 3-14)
Managing user libraries
This section addresses the following topics:
•Updating and copying user libraries using KULT command-line utilities(on page 3-1) describes
two command-line utilities. One utility provides a command-line method to copy user libraries.
The other utility provides a means to update user libraries after they are copied.
•Performing other KULT tasks using command-line commands (on pag e 3-3) describes a series of
command-line commands. These commands can be used individually or in a batch file to perform
Updating and copying user libraries using KULT command-line
various KULT tasks without opening the KULT user interface.
utilities
This section describes the command-line uti lit ies kultupdate and kultcopy.
Section
Programming
3: User module and library management Model 4200A-SCS KULT and KULT Extension
Updating user libraries using kultupdate
If you copy user libraries to a new storage location (another user directory or drive), you must use the
kultupdate utility to update the user libraries. User libraries must be updated to ensure the
correctness of all path information, which is built into the library. The kultupdate utility rebuilds
each user module in the library and also rebuilds the library.
Usage
kultupdate <library_name> [options]
Options
You can place any of the following options at the [options] position in the command:
•-dep <library_dep_1>...[library_dep_6]
Specifies up to six libraries on which library_name depends.
•-hide
Hides library_name so that it is not visible in Clarius.
•+hide
Shows library_name so that it is vis ib le in Clar i u s .
Example
Update the KI590ulib library in the active user-library directory, which depends on the
Winulib library:
C:\>kultupdate KI590ulib -dep Winulib
Copying user libraries using kultcopy
The kultcopy utility copies any user library from any accessible storage location to the active
user-library directory. The kultcopy utility:
•Performs kultupdate so that the user library is immediately ready for use. Refer to Updating
user libraries using kultupdate(on page 3-2) for more information.
•Copies the user library that is specified by the "Start-In" user-library directory, which is the
directory in which you start the kultcopy command.
To successfully copy a user library to the active user-library directory, you must start kultcopy in the
following directory:
<source_lib_path>\<source_lib_name>\src
This directory is called the "Start-In" directory, where:
• <source_lib_path> is any accessible user-library directory.
• <source_lib_name> is the name of the specific user library to be copied.
3-2 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
module and library management
-SCS KULT and KULT Extension Programming Section 3: User
Usage
kultcopy <library_name> [options]
Options
Any of the following options may be placed at the [options] position in the com mand :
•-dep <library_dep_1>...[library_dep_6]
Specifies up to six libraries on which library_name depends.
•-hide
Hides library_name so that it is not visible in Clarius.
•+hide
Shows library_name so that it is vis ib le in Clar i u s .
You can use kultcopy restore the original userlib directory. A backup copy of the userlib directory is
provided at c:\s4200\sys\factory\usrlib.
If there are images linked to the original UTMs, the new modules point to the images in the original
directory, even though the files for the images were moved. You need to manually change the path
to the new directory.
Performing other KULT tasks using command-line commands
The KULT command-line interface lets you load, build, or delete user libraries and add or delete user
modules without opening the KULT user interface. This feature is useful when developing and
managing user libraries. The commands can be used individually or in a batch file.
The general format for a command line instruction is as follows:
The individual items in the instruction are as follows:
•The item subcommand may be any one of these subcommands:
add_mod
bld_lib
del_lib
del_mod
gui
help
new_lib
new_mod
unzip
zip
4200A-KULT-907-01 Rev. C March 2023 3-3
Section
Programming
3: User module and library management Model 4200A-SCS KULT and KULT Extension
• The item <library_name> specifies the name of the library involved in the commanded action.
• The item [options] includes one or more of these options:
-d<directory_name>
-hide
+hide
-dep <library_dep_1>.....[library_dep_6]
build_type
• These options are described in the following descriptions of individual subcommands.
• If appropriate to the commanded action, [module] specifies the name of the involved user
module.
The sections that follow describe the subcommands.
gui subcommand
The gui subcommand launc hes the KULT ed itor.
Usage
kult gui [option] [type]
The -build_type option may be placed at the [options] position in the command. The following
[type] options are available:
•Release
Default option. This option builds the library more efficiently than the Debug option.
•Debug
Use this option if you want to use an integrated development environment, such as Visual Studio
Code, to debug your source code.
Examplekult gui -build_type Release
new_lib subcommand
The new_lib subcommand lets you create a new user library without any user modules. Its action is
equivalent to the following steps in KULT:
• Starting KULT
• Selecting File > New Library
• Entering a new library name
• Selecting OK
• Selecting File > Exit
3-4 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
User module and library management
-SCS KULT and KULT Extension Programming Section 3:
Usage
kult new_lib -l<library_name>
The <library_name>user library is created in the active user-library directory.
bld_lib subcommand
The bld_lib subcommand lets you build a user library from the command line. Its action is
equivalent to the following steps in KULT:
• Starting KULT
• Selecting File > Open Library
• Selecting the <library_name> user library
• Selecting OK, selecting Options > Build Library
• After the build is completed, selecting File > Exit
Usage
kult bld_lib -l<library_name> [options]
Builds the <library_name> user library in the active user-library directory.
Any of the following may be placed at the [options] position in the command:
•-dep <library_dep_1>...[library_dep_6]
Specifies up to six user libraries upon which library_name depends.
Dependent user libraries must be in the active user-library directory. For more information about
dependent libraries, refer to Dependent user modules and user libraries (on page 3-9
).
•+hide
Hides library_name so that it is not visible in Clarius.
•-hide
Shows library_name so that it is vis ib le in Clar i u s .
The C:\s4200\kiuser\usrlib\<library name>\build folder is created when you run the
bld_lib subcommand or select the Build Library menu option. This folder can be safely deleted
for debugging purposes.
4200A-KULT-907-01 Rev. C March 2023 3-5
Section
Programming
3: User module and library management Model 4200A-SCS KULT and KULT Extension
del_lib subcommand
The del_lib subcommand lets you delete a library from the command line. Its action is equivalent to
the following steps in KULT:
• Starting KULT
• Selecting File > Delete Library
• Selecting a user library to be deleted
• Selecting OK
• Selecting File > Exit
Usage
kult del_lib -l<library_name>
The <library_name>user library is deleted from the active user-library directory.
new_mod subcommand
The new_mod subcommand lets you create a new module in a user library. Its action is equivalent to
the following steps in KULT:
• Starting KULT
• Selecting File > Open Library > <library_name>
• Select OK
• Selecting File > New Module
• Entering a new module name
• Selecting Apply
• Selecting File > Exit
Usage
kult new_mod -l<library_name> <module>
The <module> module is created in the <library_name> library.
Where:
•<library_name> is the target library into which <module> is to be created. It must be in the
active user-library directory.
•<module> is the new module name.
3-6 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
User module and library management
-SCS KULT and KULT Extension Programming Section 3:
add_mod subcommand
The add_mod subcommand lets you add or copy a user module from one user library (source) to
another library (target). Its action is equivalent to the following KULT steps:
• Starting KULT
• Selecting File > Open Library
• Selecting the <source_lib_name> source library
• Selecting File > Open Module
• Selecting the <module> source module
• Selecting File > Copy Module
• Selecting the <library_name> target library
• Entering a target-modu le n ame
• Selecting File > Exit
All user modules must be named uniquely, even if they are duplicates that reside in different user
libraries. The add_mod subcommand automatically assigns a target-module name that is a
derivative of the source-module name. The naming convention is as follows:
<source_library_name>_<module>.
•<library_name> is the target library into which <module> is to be copied. It must be in the
active user-library directory.
• <source_lib_path> is any accessible user-library directory.
• <source_lib_name> is the name of the specific user library from which <module> is to be
copied.
•<module> is the source user module.
You must use the -d option when you execute add_mod in a directory other than
<source_lib_path>\<source_lib_name>.
4200A-KULT-907-01 Rev. C March 2023 3-7
Section
Programming
3: User module and library management Model 4200A-SCS KULT and KULT Extension
del_mod subcommand
The del_mod subcommand lets you delete a module from the command line. Its action is equivalent
to the following steps in KULT:
• Starting KULT
• Selecting File > Delete Module
• Selecting a user module to be deleted
• Selecting OK
• Selecting File > Exit
Usage
kult del_mod -l<library_name> <module>
Where:
•<library_name> is the target library from where <module> will be deleted. It must be in the
active user-library directory.
•<module> is the name of the module to be deleted.
zip subcommand
The zip subcommand creates a .zip file for a user library.
Usage
kult zip -l<library_name> [password] <zipfile_name>
The <library_name> user library is created in the active user-library directory.
The [password] parameter is optional.
unzip subcommand
The unzip subcommand unzips a file containing a KULT library.
Usage
kult unzip [-dest_path] [password] <zipfile_name>
Where:
• [-dest_path] is the target directory where the file will be unzipped.
• [password] is required if the file was compressed using the password parameter in the zip
subcommand.
The <zipfile_name> archive is unzipped in the active user-library directory unless the
[-dest_path] parameter is specified. The [-dest_path] parameter should not be used when
you import a user library.
3-8 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
ary management
-SCS KULT and KULT Extension Programming Section 3: User module and libr
help sub command
The help subcommand displays all usage information for subcommands and options.
Usage
kult help
Dependent user mo dules and user li braries
KULT allows a user module to call other user modules. A called user module can be in the same user
library as the calling module or can be in another user library. When the module that you are creating
calls a module in another user library, you must:
1. Select Options > Library Dependencies.
2. Specify each called library from the list that is displayed.
You must select user module and user-library dependencies carefully. Observe the following:
•Try to put user modules with interdependencies in the same user library and minimize the
interdependencies between libraries. This practice helps to avoid problematic user library
dependency loops (Lib1 relies on Lib2, Lib2 relies on Lib3, Lib3 relies on Lib1).
•If a user module in one user library must depend on user modules in other user libraries, take
care when selecting the user libraries to be linked with the user module under development. The
next section provides guidance.
The user libraries to be linked are saved so that future rebuilds do not require the dependencies to
be selected again. This information is stored in the <library_name>_modules.makfile in the
%KI_KULT_PATH%\<library_name>\kitt_obj directory.
•Structure dependencies hierarchically to avoid circular dependencies, and then build the
dependent user libraries in the correct order. The next two sections provide guidance.
Structuring dependencies hierarchically
You can avoid user library circular dependency by calling user libraries in a hierarchical design, as
illustrated in "Hierarchical design for user-library dependencies" below.
Observe the following:
•Design lower-level user modules in the calling hierarchy so that they do not require support from
higher-level modules. That is, lower-level user modules should not require calls to higher-level
modules to perform their required tasks.
•Use several general-purpose low-level-library user modules to do a task rather than a single,
do-all, higher-level-library user module.
4200A-KULT-907-01 Rev. C March 2023 3-9
Section
Programming
0
liba
Test
void Test(void)
}
1
liba1
CalledA1
void CalledA1(void)
}
2
liba2
CalledA2
void CalledA2(void)
}
3
liba3
CalledA3
void CalledA3(void)
}
3: User module and library management Model 4200A-SCS KULT and KULT Extension
You may find it helpful to prefix user modules with the user-library name as an identifier, for example,
liba_ModuleName for user modules in liba. This avoids duplicate user module names and
prevents confusion with similarly named modules that are in other user libraries and source files.
When you execute the File > Copy Library command, KULT automatically appends the user library
name to each user module in the new user library name. KULT also appends the library name, as a
suggestion, when you execute the File > Copy Module command.
In the following table, the series of coded user modules amplifies the hierarchical dependencies
shown in the following figure.
Coded user modules illustrating the use of hierarchical user library dependencies
Hierarchy
A user module in liba calls a user module in libal. In turn, a user module in liba1 calls a user
module in liba2. Finally, a user module in liba2 calls a user module in liba3.
3-10 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
User module and library management
-SCS KULT and KULT Extension Programming Section 3:
Figure 42: Hierarchical design for user library dependencies
Building dependent user libraries in the correct order
When KULT builds a user library that depends on other user libraries, it must link to each of these
libraries. For example, when KULT builds liba, the following linkages occur: liba is linked with
liba1, the liba/liba1 pair is linked with liba2, the liba/liba1/liba2 trio is linked with liba3,
and so on. Therefore, a series of hierarchical dependencies requires a reverse hierarchical build
order, starting first with the lowest-level user library. Before building any dependent user library, you
must first successfully build each library on which it depends, as illustrated below:
4200A-KULT-907-01 Rev. C March 2023 3-11
Section
amming
3: User module and library management Model 4200A-SCS KULT and KULT Extension Progr
• If liba depends on liba1, liba cann ot succ es sfully build unt il liba1 has been built.
• If, additionally, liba1 depends on liba2, both liba and liba1 cannot successfully build until
liba2 has been built.
•Finally, if liba2 depends on liba3, then the three higher level user libraries (liba, liba1, and
liba2) cannot successfully build until liba3 has been built.
The following procedure illustrates the correct reverse build order for the dependencies shown in the
table and figure in Structuring dependencies hierarchically (on page 3-9
based on the assumption that each of the interdependent user modules are newly created or were
edited since the last build. You do not need to repeat builds that are already complete up to a given
level of dependency.
Build the Level 3 user module and user library:
1. Build the saved CalledA3 user module, which is in the liba3 user library (in the KULT Options
menu, select Build).
2. Build the liba3 user library (in the KULT Options menu, select Build).
). This is a general procedure
Build and set dependencies for the Level 2 user module and user library:
1. Build the saved CalledA2 user module, which is in the liba2 user library.
2. Select Options > Library Dependencies.
3. Select liba3 from the Library Dependencies list box.
4. Select Apply.
5. Build the liba2 user library.
Build and set dependencies for the Level 1 user module and user library:
1. Build the saved CalledA1 user module, which is in the liba1 user library.
2. Select Options > Library Dependencies.
3. Select liba2 from the Library Dependencies list box.
4. Select Apply.
5. Build the liba1 user library.
Build and set dependencies for the Level 0 user module and user library:
1. Build the saved Test user module, which is in the liba user library.
2. Select Options > Library Dependencies.
3. Select liba1 from the Library Dependencies list box.
4. Select Apply.
5. Build the liba user library.
This reverse hierarchical build order results in a linking scheme that satisfies the dynamic linking
requirements of Microsoft
3-12 4200A-KULT-907-01 Rev. C March 2023
®
Windows®.
Model 4200A
User module and library management
-SCS KULT and KULT Extension Programming Section 3:
Formatting user module help for the Clarius Help pane
If your user module includes a help description, but it is not set up for HTML, when you create a UTM
in Clarius, the Help pane displays the Open UTM Comments button. If you select this button, text
from the Description tab in KULT is displayed in an ASCII browser dialog.
You can set up this help to display as formatted HTML in the Help pane using PHP Markdown Extra
tools. On the first line of the description, add the following stylesheet and MarkdownExtra code:
In order to see the help in Clarius, you must build the UTM and rebuild the library after entering the
Markdown code.
To format the text, you can use some of the following options:
•Create a first level heading: Place ===== under a line to center and bold the line. (You can use
any number of = characters.)
•Create a second level heading: Place -------- under a line to bold the line. (You can use any
number of - characters.)
•To create list: Insert a blank line before the start of the list, then use 1., 2., and so on to number
each item in the list.
• Italicize text: Place * before and after the text to be italicized.
• Display text in a fixed-width font: Put six spaces before each line of the text or use four tilde
characters (~~~~) before and after the lines of text.
You can make changes to the .c file of the user module with KULT or a text editor. After saving
changes, to view the changes, select another project tree object and then return to the UTM.
An example of the code entered in the Description tab is shown in Documenting the user module
page 2-8). An example of the result in the Help pane in Clarius is shown in Checking the user module
(on page 2-11).
For information on additional formatting options, refer to the PHP Markdown Extra website of
Pause test sequence with a prompt to Abort, Retry or Ignore
InputOkCancelDialog
Pause test sequence for an input prompt; enter input data (OK) or Cancel
OkCancelDialog
Pause test sequence with a prompt to continue (OK) or Cancel
OkDialog
Pause test sequence with a prompt to continue (OK)
RetryCancelDialog
Pause test sequence with a prompt to Retry or Cancel
YesNoCancelDialog
Pause test sequence with a Yes, No, or Cancel decision prompt
YesNoDialog
Pause test sequence with a Yes or No decision prompt
3: User module and library management Model 4200A-SCS KULT and KULT Extension
Creating project prompts
KULT provides user modules that you can use to create dialogs to pause a test sequence with a
prompt. These dialogs are available as user modules, shown in the following table.
You define the text message for the prompt. When one of these user modules is run, the test
sequence pauses. The test sequence continues when a button on the dialog is selected.
Winulib user library
User module Description
Using dialog boxes
The Winulib user library has user modules for six action or decision dialogs and one input dialog.
The dialog, with example prompts, are shown in Dialog formats (on page 3-14
The text message for a prompt is entered by the user into the user module. See “Winulib user-library
reference” in the Model 4200A-SCS Clarius User's Manual for details on the user modules.
An example using the OK dialog is provided in Dialog test examples (on page 3-15).
Dialog formats
The OK dialog in the following figures has only one button. You can use this dialog to pause a test
sequence to make an announcement (for example, "Test Finished"), or prompt for an action (for
example, "Connect 590 to DUT"). When OK is selected, the test sequence continues.
).
3-14 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
User module and library management
-SCS KULT and KULT Extension Programming Section 3:
The other dialogs have two or three buttons, as shown in the following examples. When a button on a
dialog is selected, a status value that corresponds to that button is placed in the Analyze sheet for the
action. If there are input parameters, the entries for the input parameters are placed in the Analyze
sheet. You can pass a parameter value into a user-created routine.
To pass parameters, the dialog user module must be called from another user-created user module
that is designed for parameter passing. A parameter that is in the Analyze sheet is passed to a
routine in the user-created user module to perform the appropriate operation or action.
An example to demonstrate parameter passing is provided in Dialog test examples (on page 3-15).
Dialog test examples
The following examples demonstrate how you can use dialogs in a test sequence.
Example: Announce end of test
For this example, you will create a user test module (UTM) that uses the OK dialog user module. This
dialog announces the end of a test sequence. You can use this UTM in any project at the end of any
test sequence.
To create an end-of-test announcement:
1. In the Clarius project tree, select the last test. The announcement occurs after this test.
2. Choose Select.
3. Select the Tests tab.
4200A-KULT-907-01 Rev. C March 2023 3-15
Section
Programming
3: User module and library management Model 4200A-SCS KULT and KULT Extension
4. For the Custom Test, select Choose a test from the pre-programmed library (UTM).
5. Drag Custom Test to the project tree. The test has a red triangle next to it to indicate that it is
not configured.
6. Select Rename.
7. Enter the name End of test prompt.
8. Select Configure.
9. In the Test Setting pane on the right, set the User Libraries to Winulib.
10. Set User Modules to OkDialog.
11. For NumberOfMessages, enter 2.
12. For Message1Text, enter Test Finished.
13. For Message2Text, enter Click OK to continue. An example is shown in the following figure.
Figure 43: New UTM using OkDialog user module
14. Select Save.
When you run the test sequence, the end of test dialog displayed, as shown in the following figure.
Select OK to continue.
Setting up Visual Studio Code for library development .......... 4-10
Visual Studio code overview .................................................. 4-13
KULT side bar ........................................................................ 4-17
Working with user libraries in Visual Studio Code .................. 4-18
Working with modules in Visual Studio Code ......................... 4-25
Introduction
Section 4
KULT Extension for Visual Studio Code
The Keithley KULT Extension for Visual Studio Code gives you the ability to write, compile, and
debug user libraries outside of KULT. Combining the user-friendly Visual Studio Code editor with
KULT creates an integrated development environment (IDE).
This section describes how to download, install, and set up Visual Studio Code and the KULT
Extension.
You can use the KULT Extension for Visual Studio Code on a computer with Clarius V1.8 or higher
installed. All features for the KULT Extension are available on the computer version of Clarius except
the debugging tool. Installation and setup instructions are the same on the 4200A and the computer.
The documentation in this section was verified against Visual Studio Code version 1.71.
Installation
You can install Visual Studio Code and the KULT Extension with or without a connection to the
internet on the instrument.
These instructions provide information on installing the KULT Extension for the first time and for
updating it if Clarius was reinstalled.
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extension
Download Visual Studio Code
If you cannot connect to the internet from the instrument, use another computer to download Visua l
Studio Code.
To download Visual Studio Code:
1. Go to the Visual Studio Code download site (code.visualstudio.com/download
2. Download the Windows User Installer, either 32-bit or 64-bit.
3. If you are downloading from another computer, copy the installation file to a USB flash drive.
Install Visual Studio Code
To install Visual Studio Code:
1. If you downloaded the installation files to a USB flash drive, copy the files to the instrument.
2. Start the installer.
3. Complete the installation wizard.
4. On the Select Additional Tasks dialog, select Add to PATH (requires shell restart). This allows
Visual Studio Code to be called from the command line.
5. Make other selections as needed and complete the wizard.
Figure 44: Select additional tasks
).
4-2 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
de
-SCS KULT and KULT Extension Programming Section 4: KULT Extension for Visual Studio Co
Install extensions with an internet connection
To install Visual Studio Code extensions:
1. From Visual Studio Code, select the Extensions icon in the left navigation. The Extensions
pane opens.
Figure 45: Extensions icon
2. Search for C++ in the Marketplace and select C/C++.
3. Select Install.
Figure 46: Install the C/C++ Exte nsion
4200A-KULT-907-01 Rev. C March 2023 4-3
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extensi on
4. At the top of the Extensions: Marketplace pane, select ... and select Install from VSIX.
Figure 47: Install from VSIX
5. Select C:\s4200\vscode\kult-extension.vsix.
6. Select Install. This instal ls the KULT Extens i on to Visu al Stud io Cod e.
Figure 48: Install the KULT Extension to Visual Studio Code
7. Close Visual Studio Code and reopen to complete the installation and enable all extensions.
8. Continue to Set up Visual Studio Code for Library Development (on page 4-10
).
4-4 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT Extension for Visual Studio Code
-SCS KULT and KULT Extension Programming Section 4:
Install extensions without an internet connection
If you do not have an internet connection, you need to use another computer to go the Visual Studio
Marketplace to download the Microsoft C/C++ Extension.
To download the Microsoft C/C++ Extension:
1. Go to the C/C++ page of the Visual Studio Marketplace
2. Scroll down to Offline Installation and select the link
https://github.com/Microsoft/vscode-cpptools/releases.
Figure 49: Offline installation options
4200A-KULT-907-01 Rev. C March 2023 4-5
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extensi on
3. Find the version with the Latest Release tag that is verified. Select the version number to view the
files. An example is shown in the following graphic.
Figure 50: Example of a version tagged with Latest Release and Verified
4. Download cpptools-win32.vsix.
Figure 51: Microsoft C/C++ extension
5. Copy the file to a USB drive.
Install the Microsoft C/C++ Extension on the 4200A-SCS:
1. Copy cpptools-win32.vsix from the USB drive to the C:\s4200\vscode folder on the
4200A-SCS.
2. Open Visual Studio Code.
3. Select the Extensions icon in the left navigation. The Extensions pane opens.
Figure 52: Extensions icon
4-6 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT Extension for Visual Studio Code
-SCS KULT and KULT Extension Programming Section 4:
4. Select … at the top of the Extensions pane.
5. Select Install from VSIX.
6. Select the cpptools-win32.vsix file and select Install.
Figure 53: Install from VSIX with n o internet connection
7. Select … at the top of the Extensions pane again.
8. Select Install from VSIX.
9. Select the kult-extensions.vsix file and select Install.
10. Close Visual Studio Code and reopen to complete the installation and enable all e x tensions .
11. Continue to Set up Visual Studio Code for Library Development (on page 4-10
Updating the KULT Extension after installing Clarius
If you installed a new version of Clarius, you must uninstall and reinstall the KULT Extension.
To uninstall the KULT Extension:
1. Open Visual Studio Code.
2. From Visual Studio Code, select the Extensions icon in the left navigation. The Extensions pane
opens.
Figure 54: Extensions icon
).
4200A-KULT-907-01 Rev. C March 2023 4-7
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extensi on
3. Select the KULT Extension.
Figure 55: Visual Studio Code Extension Marketplace
4. Select Uninstall.
Figure 56: Uninstall the KULT Ex tension
5. Close Visual Studio Code.
To reinstall the KULT Extension:
1. From Visual Studio Code, select the Extensions icon in the left navigation. The Extensions pane
opens.
Figure 57: Extensions icon
4-8 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
for Visual Studio Code
-SCS KULT and KULT Extension Programming Section 4: KULT Extension
2. At the top of the Extensions: Marketplace pane, select ... and select Install from VSIX.
Figure 58: Install from VSIX
3. Select C:\s4200\vscode\kult-extension.vsix.
4. Select Install.
Figure 59: Install the KULT Extension to Visual Studio Code
5. Close Visual Studio Code and reopen to compl ete the i nstal lat ion and enabl e all ex tens ions.
4200A-KULT-907-01 Rev. C March 2023 4-9
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extensi on
Setting up Visual Studio Code for library developmen t
Before using Visual Studio Code for developing KULT libraries, you need to open the user library so
that you can access all the libraries without switching folders. You can open single user libraries by
opening the folder of the user library. On startup, Visual Studio Code reopens the last folder opened.
You also need to create the Visual Studio Configuration files before you open a single library. Visual
Studio Code configuration files adopt the features of Visual Studio Code to be used with Keithley
User Libraries.
Opening the user library in Visual Studio Code
To open the user library folder:
1. Go to File > Open Folder to select a folder to open in Visual Studio Code. You must select a
valid user library folder to use the KULT Extension.
Figure 60: Open folder dialog
2. Open the usrlib folder C:\s4200\kiuser\usrlib.
Creating the Visual Studio Code configurat ion fil es
Visual Studio Code configuration files adopt the features of Visual Studio Code to be used with
Keithley User Libraries.
The c_cpp_properties.json configuration file controls the Intellisense features of the C/C++
Extension from Microsoft, such as compiler-specific syntax checking and header file paths.
Intellisense errors may occur if these features are not configured for Keithley user libraries. The errors
do not affect compilation or code execution in Clarius, but may make code difficult to troubleshoot.
The launch.json file has configuration settings for GNU Debugger (GDB), which is used when
debugging. Debugging attaches GDB to the Clarius running process UTMServer.exe.
4-10 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT Extension for Visual Studio Code
-SCS KULT and KULT Extension Programming Section 4:
A .vscode folder is created with the configuration files in the folder that is open (workspace path). All
files in the workspace path reference these configuration files. If the usrlib folder is open, the
configuration files can be created once, and all the libraries will use them. If you are opening
individual libraries, these files need to be created for each library the first time it is opened. Created
configuration files can be edited later. The file settings.json contains Visual Studio Code
workspace level configuration settings.
Create the C/C++ Intellisense configuration file
To create the C/C++ Intellisense configuration file:
1. Open the Command Palette by selecting View > Command Palette.
2. Search KULT to filter for KULT Extension commands.
3. Select the command KULT: Create C/C++ Intellisense Configuration File. This generates the c_cpp_properties.json configuration file and places it in the .vscode folder in the working
directory. The command does not overwrite an existing configuration file.
Figure 61: Generate the c_cpp_properties configuration file
4. Open the KULT side pane by selecting KULT on the left side of the screen.
5. Select a library in the Libraries pane.
6. In the Miscellaneous pane at the bottom of the KULT side pane, select the
c_cpp_properties.json file. Add paths to header files in the includePath settings. Paths are
entered in quotes and separated by commas. This file can be updated at any time.
The paths to the include folder, usrlib folder, and compiler are necessary for most user libraries and
are automatically entered. Deleting these paths causes Intellisense errors in factory-user libraries.
4200A-KULT-907-01 Rev. C March 2023 4-11
Section
Programming
4: KULT Extension for Visual Studio Code Model 4200A-SCS KULT and KULT Extension
Figure 62: c_cpp_properties
Create the launch configuration file
To create the launch configuration file:
1. Open the Debug side bar by selecting the debug icon on the left side.
2. Select Create a launch.json file.
Figure 63: Create a launch.json file
4-12 4200A-KULT-907-01 Rev. C March 2023
Model 4200A
KULT Extension for Visual Studio Code
-SCS KULT and KULT Extension Programming Section 4:
3. Select KULT Attach Process. The launch.json file is added with the settings to attach to the
UTM Server. The file can be accessed later in the Miscellaneous tab of the KULT side bar.
Figure 64: KULT Attach Process
Figure 65: Tab with launch.json
Visual Studio code overview
The following topics describe the features of Visual Studio Code. To learn more about Visual Studio
Code as an editor, visit Visual Studio Code (code.visualstudio.com/
4200A-KULT-907-01 Rev. C March 2023 4-13
).
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.