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