Keithley Instruments, Inc. warrants this product to be free from defects in material and workmanship for a period of
one (1) year from date of shipment.
Keithley Instruments, Inc. warrants the following items for 90 days from the date of shipment: probes, cables,
software, rechargeable batteries, diskettes, and documentation.
During the warranty period, Keithley Instruments will, at its option, either repair or replace any product that proves
to be defective.
To exercise this warranty, write or call your local Keithley Instruments representative, or contact
Keithley Instruments headquarters in Cleveland, Ohio. You will be given prompt assistance and return instructions.
Send the product, transportation prepaid, to the indicated service facility. Repairs will be made and the product
returned, transportation prepaid. Repaired or replaced products are warranted for the balance of the original
warranty period, or at least 90 days.
LIMITATION OF WARRANTY
This warranty does not apply to defects resulting from product modification without Keithley Instruments’ express
written consent, or misuse of any product or part. This warranty also does not apply to fuses, software,
non-rechargeable batteries, damage from battery leakage, or problems arising from normal wear or failure to follow
instructions.
THIS WARRANTY IS IN LIEU OF ALL OTHER WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. THE REMEDIES
PROVIDED HEREIN ARE BUYER’S SOLE AND EXCLUSIVE REMEDIES.
NEITHER KEITHLEY INSTRUMENTS, INC. NOR ANY OF ITS EMPLOYEES SHALL BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OF ITS INSTRUMENTS AND SOFTWARE, EVEN IF KEITHLEY INSTRUMENTS, INC. HAS BEEN ADVISED IN
ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES. SUCH EXCLUDED DAMAGES SHALL INCLUDE, BUT
ARE NOT LIMITED TO: COST OF REMOVAL AND INSTALLATION, LOSSES SUSTAINED AS THE RESULT OF
INJURY TO ANY PERSON, OR DAMAGE TO PROPERTY.
A G R E A T E R M E A S U R E O F C O N F I D E N C E
The following safety precautions should be observed before using this product and any associated instrumentation. Although some
instruments an d access ories would n ormally be used with non-h azardous voltag es, there are situ ations where h azardous condition s may
be present.
This product is inte nded for us e by qual ified person nel who recognize s hock haz ards and are famili ar with the s afety prec autions requ ired
to avoid possible in jury. Rea d and fo llow all inst a llatio n, opera tion, an d mai ntenanc e info rmatio n carefu lly b efore us ing the product. Ref er
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 inten ded function. T hey must be trained in e lectrical safe ty procedures a nd proper us e of the inst rument.
They must be protected from electric shock and contact with hazardous live circuits.
Maintenance personnel perform routine procedures on the product to keep it op era tin g p r op erly, fo r e xam pl e, se tting the line voltage or
replacing consuma ble ma terials . Main tenanc e proc edures are descri bed in t he u ser docum ent ation. The proced ures expl icitly st ate if th e
operator may perform them. Otherwise, they should be performed only by service personnel.
Safety Precautions
Service personnel are trained to wor k on live circuits, perform safe installations, and repair products. Only properly trained service
personnel may perform installation and service procedures.
Keithley Instruments products are designed for use with electrical signals that are rated Measurement Category I and Measurement
Category II, as described in the International Electrotechnical Commission (IEC) Standard IEC 60664. Most measurement, control, and
data I/O signals are Measurement Ca tegory I and must not be dire ctly connected to ma ins voltag e or to voltage sourc es with high transient
over-voltages. Measurement Category II connections require protection for high transient over-voltages often a s sociated with local AC
mains connect ions. Assume all measurement, co ntrol, and dat a I/O connec tions are for conn ection to Cate gory I sources u nless otherwise
marked or described in the user documentation.
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 30V RMS, 42.4V peak,
or 60VDC 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 acces s and/or insul ated from ev ery connect ion point . In some c ases, conne ctions mus t be expos ed to potenti al human c ontact.
Product operators in th ese ci rcu ms t ances must be train ed t o p r otec t themselves from the ri sk of electric shock. If the ci rcu it is capable of
operating at or above 1000V, no conductive part of the circuit may be exposed.
Do not connect switc hing cards direc tly to unlim ited power circui ts. They ar e intended to b e used with im pedance-lim ited 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.
11/07
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.
AL W AYS remove powe r from the entire te st system and d ischarge an y capa citors befo re: connecting or disconne cting cab les or jumpers,
installing or removing switching cards, or making internal changes, such as installing or removing jumpers.
Do not touch any o bject that could pro vide a c urrent p ath to the com mon sid e of the c ircuit under t est or p ower line (e arth) ground . Always
make measurements with dry hands while standing on a dry, insulated surface capable of withstanding the voltage being measured.
The instrument and accessories must be used in accordance with its specifications and operating instructions, or the safety of the
equipment may be impaired.
Do not exceed the maxi mum s ignal levels of the ins tru ment s and acces sories , as defi ned in th e spec ifica tion s and op erating information,
and as shown on the instrument or test fixture panels, or switching card.
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 safety earth 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 screw is present, connect it to safety earth ground using the wire recommended in the user documentation.
The symbol on an instrument indicates that the user should refer to the operating instructions located in the user documentation.
The symbol on an instrument shows that it can source or measure 1000V or more, including the combined effect of normal and
common mode voltages. Use standard safety precautions to avoid personal contact with these voltages.
The symbol on an instrument shows that the surface may be hot. Avoid personal contact to prevent burns.
The symbol indicates a connection terminal to the equipment frame.
If this 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 dangers that might result in personal injury or death. Always read the
associated information very carefully before performing the indicated procedure.
The CAUTION heading in th e u se r do cu me ntation explains ha za rds th at could damage the i nstrument. Such dama ge ma y inv al idate the
warranty.
Instrumentation and accessories shall not be connected to humans.
Before performing any maintenance, disconnect the line cord and all test cables.
T o main tain protecti on from electric sho ck and fire, replacem ent component s in mains circu its - includi ng the power trans former, tes t leads,
and input jacks - must be purchased from Keithley Instruments. Standard fuses with applicable national safety approvals may be used if
the rating and type are the same. Other components that are not safety-related may be purchased from other suppliers as long as they
are equivalent to the original component (note that selected parts should be purchased only through Keithley Instruments to maintain
accuracy and function ality of the product). If you ar e unsure about the applicabi lity of a replacement co mponent, call a Keithley Ins truments
office for information.
To clean an instrument, use a damp cloth or mild, water-based cleaner. Clean the exterior of the instrument only. Do not apply cleaner
directly to the instrumen t or allow liqui ds to enter or spi ll on the inst rument. Produ cts tha t consist of a circuit board wi th no case or chassis
(e.g., a data acquisition board for installation into a computer) should never require cleaning if handled according to instructions. If the
board becomes contaminated and operation is affected, the board should be returned to the factory for proper cleaning/servicing.
This section contains information about Keithley Command Compatible Functions. Refer to Section 2
for information on the National Instruments™ (NI)1 command compatible functions.
NOTERefer to Section 2 for NI Command Compatible Functions.
If you have any questions after reviewing this information, please contact your local Keithley
representative or call one of our Applications Engineers at 1-800-KEITHLEY (US only) or visit our
website at www.keithley.com.
Using Keithley Command Compatible functions
Microsoft® Visual Basic (Version 6.0)
To create a Windows® XP/2000/Vista Keithley Command Compatible application using the API and
Microsoft Visual Basic, follow these steps:
Step 1: Enter Visual Basic and open or create a project to use the Keithley Command
Compatible functions
To create a new project, select New Project from the File menu.
To use an existing project:
1.Open the file by selecting Open Project from the File menu. The Open Project dialog box
appears (Figure 1-1).
Figure 1-1
Open Project dialog box
2.Load the project by finding and double-clicking the project file name in the applicable directory.
Step 2: Include function declarations and constants file (IEEEVB.BAS)
If it is not already included in the project, add the IEEEVB.BAS file as a module to your project. All
Keithley Command Compatible function declarations and constants are contained in this file. These
function declarations and constants are used to develop user self-measurement applications.
1. National Instruments™ and NI are trademarks of the National Instruments Corporation.
1-2Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Add elements, such as a command button, list box, or text box, etc., on the Visual Basic form used to
design the interface. These elements are standard controls from the Visual Basic Toolbox. To place a
needed control on the form:
1.Select the needed control from the Toolbox.
2.Draw the control on the form. Alternatively, to place the default-sized control on the form, click
the form. Use the Select Objects tool to reposition or resize controls.
Step 4: Set control properties
Set control properties from the properties list. To view the properties list, select the desired control and
do one of the following:
•Press F4
•Select the Properties command in the View menu
or
•Click the Properties button on the Toolbar.
Step 5: Write the event codes
The event codes define the action desired when an event occurs. To write the event codes:
1.Double-click the control or form needing event code (the code module will appear).
2.Add new code as needed. All functions that are declared in IEEEVB.BAS can be called to
perform data acquisition operations (refer to Keithley Command Compatible function reference).
Step 6: Run your application
To run the application, either:
•Press F5
•Select Start from the Run menu
or
•Click the Start icon on the Toolbar
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics1-3
To create a Windows XP/2000/Vista Keithley command compatible library application using the
Keithley Command Compatible function library (which is CEC command-compatible) and Microsoft
Visual C/C++, follow these steps:
Step 1: Enter Visual C/C++ and open or create a project in which you wish to use
Keithley Command Compatible functions
NOTEThe project can be a new or existing one.
Step 2: Include function declarations and constants file (IEEE-C.H)
Include IEEE-C.H in the C/C++ source files that call Keithley Command Compatible functions by
adding the following statement in the source file:
#include "IEEE-C.H"
NOTEKeithley Command Compatible function declarations and constants are contained in IEEE-
C.H. Use the functions and constants to develop user self data-acquisition applications.
Step 3: Build your application
1.Set suitable compile and link options.
2.Select Build from the Build menu (Visual C/C++ 4.0 and higher).
3.Remember to link the Keithley Command Compatible library ieee_32m.lib.
1-4Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
This section contains a detailed description of Keithley Command Compatible library functions,
including the compatible library data types and function reference. The following functions are
arranged alphabetically:
GPIBBOARDPRESENT
DescriptionThis function checks if a GPIB board is present in the GPIB system.
SyntaxMicrosoft C/C++ and Borland C++
char gpib_board_present(void)
Visual Basic
GpibBoardPresent( ) As Long
Return Value0: if no GPIB is installed
1: if a GPIB board is installed
BOARDSELECT
DescriptionThis function selects a board to be the active board.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard: the board number. The valid value is from 0 to 3
DMACHANNEL
DescriptionThis function sets the DMA channel. This function is ignored for the
SyntaxMicrosoft C/C++ and Borland C++
Parameterschan: DMA channel number
ENTER
void boardselect (long int bd)
Visual Basic
call boardselect (ByVal board As Long)
Model KPCI-488LPA.
void dmachannel (long int c)
Visual Basic
call dmachannel (ByVal chan As Long)
DescriptionThis function reads data from a specified device.
SyntaxMicrosoft C/C++ and Borland C++
long int enter (char *buf, unsigned long maxlen,
unsigned long *len, long int addr,
long int *status)
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics1-5
call enter(buf As String, maxlen As Integer,
len As Integer, addr As Integer, status As Integer)
Parametersbuf: the buffer storing the received data
maxlen: the maximum bytes of data to receive. The valid value is from 0 to 65535
len:returns the actual number of received data bytes
addr: the GPIB address of the Talker
status: 0: read data successfully; 8: timeout error
FEATURE
DescriptionThis function returns the GPIB board settings or hardware features.
SyntaxMicrosoft C/C++ and Borland C++
long int feature (long int f)
Visual Basic
GPIBFeature (ByVal f As Long) As Long
Parametersf: the feature or setting information desired. Valid FEATURE values are contained in
Table 1-1.
Table 1-1
FEATURE parameters
Feature
(Constants)
IEEEListener0Checking if ListenerPresent function is supported by
IEEEIOBASE100the I/O base address of the board
IEEETIMEOUT200the I/O timeout setting of the board
IEEEINPUTEOS201the current setting of the input EOS character
IEEEOUTPUTEOS1202the current setting of the output EOS character 1
IEEEOUTPUTEOS2203the current setting of output EOS character 2
IEEEBOARDSELECT204the current active board number
Return ValueThe value of the feature or setting
INITIALIZE
DescriptionThis function opens and initializes a GPIB board.
SyntaxMicrosoft C/C++ and Borland C++
Features
(Values) Returned Information
the GPIB board; this information value is always 1.
void initialize (long int addr,
long int level)
Visual Basic
call initialize (ByVal addr As Long,
ByVal level As Long)
Parametersaddr :GPIB address assigned to the board
level:0: specifies the board as a system controller
1: specifies the board as a device
1-6Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
values following LISTEN are the GPIB
addresses of the listeners.
TALKSets the address of the talker. The
values following TALK are the GPIB
addresses of the talker. There is only
one talker at a time.
SECSets the second address of the talker or
listener. This command should follow
TALK or LISTEN.
UNTUntalk."UNT"
UNLUnlisten."UNL"
MTAMy Talk Address. Assigns the active
GPIB board as the talker.
MLAMy Listen Address. Assigns the active
GPIB board as the listener.
DATAStarts the data part. Before the DATA
command, the GPIB board has to be set
as the talker. Strings are enclosed by
quotes(') and sent as characters.
"LISTEN 1 2 3"
meaning: config devices whose GPIB
address are 1, 2 and 3, as listeners.
"TALK 0"
meaning: config device whose GPIB
address is 0, as talker.
"TALK 0 SEC 1"
meaning: config device whose primary GPIB
address is 0 and secondary address is 1 as
talker.
"MTA"
"MLA"
"DATA 'hello' 13 10"
ENDSends terminator characters. DATA
command should be called before this
command.
RENRemote Enable"REN"
EOIEnd-or-Identify. The data bytes following
EOI are the last bytes to transmit. The
last byte is sent with the EOI signal.
GTLGo To Loc al"GTL "
SPESerial Poll Enable"SPE"
SPDSerial Poll Disable"SPD"
PPCParallel Poll Configure"PPC"
PPDParallel Poll Disable"PPD"
PPUParallel Poll Unconfigure "PPU"
DCLDevice Clear"DCL"
LLOLocal Lockout"LLO"
CMDStarts GPIB command. The values
2-2Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Introduction
This section contains information about the National Instruments™ (NI)1 command compatible
functions and provides information on using the functions, as well as a reference section containing
syntax examples (C/C++, Visual Basic, etc.).
compatible status codes and NI command compatible function error codes.
NOTERefer to Section 1 for Keithley Command Compatible Functions.
If you have any questions after reviewing this information, please contact your local Keithley
Instruments representative or call one of our Applications Engineers at 1-800-KEITHLEY (US only) or
visit our website at www.keithley.com.
Appendix A contains information on NI command
Using NI Command Compatible functions
This section provides the fundamentals of building Windows® XP/2000/Vista applications using NI
command compatible functions and either Microsoft
®
Visual Basic or Microsoft Visual C/C++.
Microsoft Visual Basic (Version 6.0)
To create an application with NI command compatible functions and Visual Basic, follow these steps:
Step 1: Enter Visual Basic and open or create a project in which to use the NI command
compatible functions
To create a new project, select New Project from the File menu.
To use an existing project:
1.Open the file by selecting Open Project from the File menu. The Open Project dialog box
appears (Figure 2-1).
Figure 2-1
Open Project dialog box
2.Load the project by finding and double-clicking the project file name in the applicable directory.
1. National Instruments™ and NI are trademarks of the National Instruments Corporation.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-3
Step 2: Include function declarations and constants file (GPIB.BAS)
If it is not already included in the project, add the GPIB.BAS file. All NI command compatible function
declarations and constants are contained in this file. These function declarations and constants are
used to develop applications.
Step 3: Design the application interface
Add elements, such as a command button, list box, or text box, etc., on the Visual Basic form used to
design the interface. These elements are standard controls from the Visual Basic Toolbox. To place a
needed control on the form:
1.Select the needed control from the Toolbox.
2.Draw the control on the form. Alternatively, to place the default-sized control on the form, click
the form. Use the Select Objects tool to reposition or resize controls.
Step 4: Set control properties
Set control properties from the properties list. To view the properties list, select the desired control and
do one of the following:
•Press F4
•Select the Properties command in the View menu
or
•Click the Properties button on the Toolbar.
Step 5: Write the event codes
The event codes define the action desired when an event occurs. To write the event codes:
1.Double-click the control or form needing event code (the code module will appear).
2.Add new code as needed. All functions that are declared in GPIB.BAS can be called to perform
operations (refer to Table 2-1 through Table 2-4).
Step 6: Run your application
To run the application, either:
•Press F5
•Select Start from the Run menu
or
•Click the Start icon on the Toolbar
2-4Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Microsoft Visual C/C++
To create an application with NI command compatible functions and Microsoft Visual C/C++, follow
these steps:
Step 1: Enter Microsoft Visual C/C++ and open or create a project in which you wish to
use NI command compatible functions
NOTEThe project can be a new or existing one.
Step 2: Include the function declarations and constants file (GPIB.H)
Include GPIB.H in the C/C++ source files that call NI command compatible functions by adding the
following statement in the source file:
#include "GPIB.H"
NOTENI command compatible function declarations and constants are contained in GPIB.H. Use
the functions and constants to develop user self data-acquisition applications.
Step 3: Build your application as follows:
1.Set suitable compile and link options.
2.Select Build from the Build menu (Visual C/C++ 4.0 and higher).
3.Remember to link the NI command compatible import library GPIB-32.lib.
Overview of NI command compatible functions
The NI command compatible functions are grouped into three classes:
ibaskReturns the current value of the selected configuration item.
ibbnaAssigns the access board of the designated device.
ibclrSends the GPIB Selected Device Clear (SDC) message to the designated
device.
ibconfigSets the value of the selected configuration item.
ibdevOpens and initializes a device descriptor.
ibeosConfigures the EOS termination mode or character.
ibeotEnables or disables the action that is setting GPIB EOI line to enable while
the I/O operation is completed.
iblnChecks if there is an available device on the bus.
iblocSets the device to local control mode.
ibonlSets the device online or offline.
ibpadSets a device primary GPIB address.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-5
ibpctPasses Controller-in-Charge (CIC) status to another GPIB device that has
controller capability.
ibppcConfigures parallel polling.
ibrdReads data from a device to the indicated buffer.
ibrdaReads data from a device to the indicated buffer asynchronously.
ibrdfReads data from a device to a file.
ibrdiReads data from a device to the indicated buffer.
ibrdiaReads data from a device to the indicated buffer asynchronously.
ibrppPerforms a parallel polling.
ibrspPerforms a sequential polling.
ibsadSets or disables a device secondary GPIB address.
ibstopStops the asynchronous I/O operation.
ibtmoSets the board or device timeout period.
ibtrgSends the Group Execute Trigger (GET) message to device.
ibwaitMonitors event(s) until one or more events that are described by mask or
delay operating occur.
ibwrtWrites data from a buffer to a device.
ibwrtaWrites data from a buffer to a device asynchronously.
ibwrtfWrites data from a file to a device.
ibaskReturns the current value of the selected configuration item.
ibcacSets the assigned GPIB board to be the active controller by setting the
ATN line to enable.
ibcmdSends GPIB commands.
ibcmdaSends GPIB commands asynchronously.
ibconfigSets the value of the selected configuration item.
ibdmaEnables or disables DMA.
ibeosConfigures the EOS termination mode or character.
ibeotEnables or disables the action that is setting GPIB EOI line to enable while
the I/O operation is completed.
ibfindOpens and initializes the GPIB board descriptor.
ibgtsSets the board from active control status to standby control status.
ibistSets or clears the board individual status (ist) bit for parallel polling.
iblinesReturns the GPIB control lines status.
iblnChecks if there is an available device on the bus.
iblocSets the device to local control mode.
ibonlSets the device online or offline.
ibpadSets the device’s primary GPIB address.
ibppcConfigures parallel polling.
ibrdReads data from a device to the indicated buffer.
ibrdaReads data from a device to the indicated buffer asynchronously.
ibrdfReads data from a device to a file.
ibrdiReads data from a device to the indicated buffer.
ibrdiaReads data from a device to the indicated buffer asynchronously.
2-6Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
to request or release the System Control.
ibrsvRequests service and changes the status byte of the sequential polling.
ibsadSets or disables a board secondary GPIB address.
ibsicSets the GPIB interface’s clear (IFC) line to enable at least 100ns if the
GPIB interface is system controller.
ibsreSets or clears the Remote Enable (REN) line.
ibstopStops the asynchronous I/O operation.
ibtmoSets the board timeout period.
ibwaitMonitors event(s) until one or more events that are described by mask or
delay operating occur.
ibwrtWrites data from a buffer to a device.
ibwrtaWrites data from a buffer to a device asynchronously.
ibwrtfWrites data from a file to a device.
IEEE 488.2 functions
Table 2-3 contains IEEE 488.2 Functions.
Table 2-3
IEEE 488.2 functions
FunctionDescription
AllSpollPolls one or more devices sequentially.
DevClearSends the Selected Device Clear (SDC) GPIB message to clear
the selected device.
DevClearListClears multiple devices.
EnableLocalSends Go To Local (GTL) GPIB message to multiple devices to
allow local operation of the devices.
EnableRemoteSets Remote Enable (REN) line to allow remote programming of
devices.
FindLstnFinds listening devices on the GPIB bus.
FindRQSSequentially polls devices to determine which device is requesting
service.
PassControlSends Take Control (TCT) GPIB message. Sending this
message allows control to pass to another GPIB device having
control capability.
PPollPerforms parallel polling once.
PPollConfigControls or releases GPIB data line to configure the device to
respond to parallel polling.
PPollUnconfigRemoves configuration that allows device to respond to parallel
polling.
RcvRespMsgReads data from a device.
ReadStatusByteSequentially polls a device.
ReceiveReads data bytes from a device and then stores them in the
assigned buffer.
ReceiveSetupConfigures device and interface to a talker and a receiver.
ResetSysResets and initializes the devices.
SendWrites data bytes from the buffer to the device.
SendCmdsSends GPIB commands.
SendDataBytesSends data from the buffer to the device.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-7
SendIFCSends Interface Clear command to reset GPIB.
SendListSends data bytes to multiple GPIB devices.
SendLLOSends Local Lockout (LLO) message to all devices.
SendSetupConfigures device to receive data.
SetRWLSConfigures device to lockout status of remote control mode.
TestSRQDetects current status of the GPIB Service Request (SRQ) line.
TestSysCauses devices to process self tests. TestSys sends the "TST?"
message to the devices.
TriggerSends Group Execute Trigger (GET) GPIB message to a device.
TriggerListSends Group Execute Trigger (GET) GPIB message to multiple
devices.
WaitSRQWaits until the device controls the GPIB SRQ line.
Data Types
GPIB.BAS defines some data types. The defined data types are used by the
NI command compatible function library and are suggested for your applications. Table 2-4 shows the
names, ranges, and the corresponding data types in C/C++, Visual Basic and Delphi. These data
types are not defined in either GPIB.BAS or GPIB.PAS (they are just listed for reference).
Table 2-4
Data types
Typ e
C/C++
Type
Name
U88-bit ASCII
I1616-bit signed integer -32768 ~ 32767ShortIntegerWord
U16
2-8Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
NI command compatible function reference
Use this section as a function reference for NI command compatible functions. Refer to Section 1 for
information on Keithley Command Compatible Functions.
ibask
DescriptionThis command returns the current value of the selected configuration item.
Support Level Board / Device Level
SyntaxMicrosoft C/C++ and Borland C++
int ibask (int ud, int option, int *value)
Visual Basic
ibask (ByVal ud As Integer, ByVal opt As Integer,
rval As Integer) As Integer
-or-
call ibask (ByVal ud As Integer, ByVal opt As
Integer, rval As Integer)
Parametersud: board or device unit descriptor
option: the configuration item value will be returned (refer to valid options as shown in
Table 2-5 and Table 2-6)
value: the current value of the selected configuration item returned
Return ValueThe value of the ibsta
Error CodesEARG, ECAP, EDVR
Table 2-5
ibask board configuration parameter options
Options
(Constants)
ibaPAD0x0001The board current primary address.
ibaSAD0x0002The board current secondary address.
ibaTMO0x0003The board current I/O timeout.
ibaEOT0x00040: After termination of the writing operation, the GPIB EOI line is not
ibaPPC0x0005The current parallel polling configuration board setting.
ibaAUTOPOLL0x00070: Disable the automatic sequential polling.
ibaCICPROT0x00080: Disable the CIC protocol.
ibaIRQ0x00090: Disable the Interrupts.
ibaSC0x000A0: The board is not the GPIB System Controller.
Options
(Value)Returned Information
set to enable.
1: After termination of the writing operation, the GPIB EOI line is set to
enable.
1: Enable the automatic sequential polling.
1: Enable the CIC protocol.
1: Enable the Interrupts.
1: The board is the GPIB System Controller.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-9
ibaSRE0x000B0: While the board becomes the System Controller, the GPIB REN
ibaEOSrd0x000C0: Ignore the EOS character during reading.
ibaEOSwrt0x000D0: The EOI line is not set to enable while the EOS character is sent
ibaEOScmp0x000E0: Compare all EOS with 7 bits.
ibaEOSchar0x000FThe board current EOS character.
ibaPP20x00100: The board in the PP1 mode (Remote Parallel Polling
ibaTIMING0x0011The current board bus timing.
ibaDMA0x00120: DMA is not used for GPIB transfer.
ibaSpollBit0x00160: Disable the SPOLL bit of the
ibaSendLLO0x00170: The GPIB LLO command is not sent while the device is connected
ibaPPollTime0x00190: Use standard continue time (2μs) during parallel polling.
ibaEndBitIsNormalal0x001A 0: The END bit of the
ibaist0x0020The individual status (ist) bit of the board.
ibaRsv0x0021The current status word of the sequential polling of the board.
Options
(Value)Returned Information
line is not set to enable automatically.
1: While the board becomes the System Controller, the GPIB REN
line is set to enable automatically.
1:The reading is stopped while the EOS character is read.
during writing.
1: The EOI line is set to enable while the EOS character is sent during
writing.
1: Compare all EOS with 8 bits.
Configuration).
1: The board in the PP2 mode (Local Parallel Polling Configuration).
1: Normal timing (2μs T1 delay).
2: High speed timing (500ns T1 delay).
3: Very high speed timing (350ns T1 delay).
1: DMA is used for GPIB transfer.
1: Enable the SPOLL bit of the
by ibfind or ibdev.
1: The GPIB LLO command is sent while the device is connected by
ibfind or ibdev.
1~17: Use different continue time during parallel polling; time
corresponds to the ibtmo timing value.
EOS are received; if the EOS is received without EOI, the END bit is
not set.
1: When EOI, EOS, or both EOI and EOS is received, the END bit is
set.
ibsta.
ibsta.
ibsta is set only when the EOI or both EOI and
Table 2-6
ibask device configuration parameter options
Options
(Constants)
ibaPAD0x0001The current device primary address.
ibaSAD0x0002The current device secondary address.
ibaTMO0x0003The current device I/O timeout.
ibaEOT0x00040: After termination of the writing operation, the GPIB EOI line is not
2-10Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Options
(Values)Returned Information
set to enable.
1: After termination of the writing operation, the GPIB EOI line is set to
enable.
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Table 2-6 (continued)
ibask device configuration parameter options
Options
(Constants)
ibaREADDR0x00060: The unnecessary addressing is not operated during the device-level
ibaEOSrd0x000C0: Ignore the EOS character during reading.
ibaEOSwrt0x000D0: The EOI line is not set to enable when the EOS character is sent
ibaEOScmp0x000E0: Compare all EOS with 7 bits.
ibaEOSchar0x000FThe board current EOS character.
ibaSPollTime0x0018The waiting time of the driver for the sequential polling response. The
ibaEndBitIsNormal al0x001A 0: The END bit of the
ibaBNA0x0200The index of the GPIB access board for the assigned device
Options
(Values)Returned Information
writing or reading.
1: The addressing is operated continuously during the device-level
writing or reading.
1: The reading is stopped while the EOS character is read.
during writing.
1: The EOI line is set to enable when the EOS character is sent during
writing.
1: Compare all EOS with 8 bits.
time is represented by ibtmo timing value.
ibsta is set only when the EOI or both EOI and
EOS are received; if the EOS is received without EOI, the END bit is
not set.
1: When the EOI, EOS, or both EOI and EOS is received, the END bit
is set.
descriptor.
ibbna
DescriptionThis command assigns the device unit descriptor to the boardname.
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibbna (int ud, char *board_name)
SyntaxVisual Basic
ibbna (ByVal ud As Integer, ByVal udname As String)
As Integer
- or -
call ibbna (ByVal ud As Integer, ByVal udname As String)
Parametersud: device unit descriptor
board_name: the access board name; gpib0 for example
Return ValueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, EOIP, ENEB
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-11
DescriptionThis command sets the assigned GPIB board to be the active controller by setting the
ATN l ine to enable. The GPIB board must be the CIC (controller in charge) before
calling ibcac. Use ibsic to set the board as the CIC. The board can take control
synchronously (1), asynchronously (2), or either (v). If either, the GPIB board tries to
create the ATN signal but does not terminate the data transfer (synchronous control is
tried first). If this fails, the board takes asynchronous control by immediately creating
the ATN signal without considering any current data transfer for asynchronous control.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibcac(int ud, int synchronous)
Visual Basic
idcac (ByVal ud As Integer, ByVal v As Integer) As
Integer
- or -
call ibcac (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board unit descriptor
ibclr
v: either synchronous or asynchronous control
0: asynchronously
1: synchronously
Return ValueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, EOIP, ENEB
DescriptionThis command sends the GPIB Selected Device Clear (SDC) message to the
assigned device.
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibclr (int ud)
Visual Basic
idclr (ByVal ud As Integer) As Integer
- or -
call ibclr (ByVal ud As Integer)
Parametersud: device unit descriptor
Return ValueThe value of the ibsta
Error CodesEARG, EBUS, ECIC, EDVR, EOIP, ENEB
2-12Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
ibcmd
DescriptionThis command sends GPIB commands. Command words are used to configure the
GPIB status. ibwrt is used to send the device self-control command. To return the
number of transferred command bytes in the global variable, use ibcntl.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibcmd (int ud, const void *cmd, long cnt)
Visual Basic
idcmd (ByVal ud As Integer, ByVal buf As String,
ByVal cnt As Long) As Integer
- or -
call ibcmd (ByVal ud As Integer, ByVal buf As
String)
DescriptionThis command sends GPIB commands asynchronously. Command words are used to
cnt: the number of the command bytes; the command bytes that are to be sent
configure the GPIB status and control GPIB devices. ibwrt is used to send the device
self-control command. To return the number of transferred command bytes in the
global variable, use ibcntl.
The design of the asynchronous I/O commands (ibcmda, ibrda, ibwrta) is that
applications can perform other non-GPIB operations while the I/O is in progress. If
asynchronous I/O has begun, later GPIB commands are strictly limited — any
commands that would interfere with the I/O that is in progress are not allowed. If the I/
O has completed, the application and the driver must be re-synchronized.
Use one of the following functions to re-synchronize:
ibwait: If the CMPL bit of the returned ibsta is set, the driver and application are resynchronized.
ibnotify: If the ibsta value sent to the ibnotify callback contains CMPL, the driver and
application are re-synchronized.
ibstop: The I/O is stopped, and the driver and application are re-synchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and application are re-
synchronized.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibcmda (int ud, const void *cmd, long cnt)
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-13
DescriptionThis command sets the value of the selected configuration item.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibconfig (int ud, int option, int value)
SyntaxVisual Basic
idconfig (ByVal ud As Integer, ByVal opt As Integer,
ByVal v As Integer) As Integer
- or -
call ibconfig (ByVal ud As Integer,
ByVal opt As Integer, ByVal v As Integer)
Parametersud: board or device unit descriptor
opt: the configuration item that needs to be changed (valid options are shown in Table
2-7 and Table 2-8)
v: the value of the configuration item that needs to be changed
Return ValueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, EOIP
Table 2-7
Board configuration parameter options
Options
(Constants)
ibcPAD0x0001Set the board current primary address.
ibcSAD0x0002Set the board current secondary address.
ibcTMO0x0003Set the board current I/O timeout.
ibcEOT0x0004Set the data termination mode for writing.
ibcPPC0x0005Configure the board for parallel polling. Default: zero.
ibcAUTOPOLL0x00070: Disable the automatic sequential polling.
2-14Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Options
(Value)Valid Values
1: Enable the automatic sequential polling.
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Table 2-7 (continued)
Board configuration parameter options
Options
(Constants)
ibcSC0x000ARequest or release system control. The same as ibrsc.
ibcSRE0x000BControl the Remote Enable (REN) line. The same as ibsre. Default: 0.
ibcEOSrd0x000C0: Ignore the EOS character during reading.
ibcEOSwrt0x000D0: The EOI line is not set to enable while the EOS character is sent during
ibcEOScmp0x000E0: Compare all EOS with 7 bits.
ibcEOSchar0x000FAny 8-bit value. This byte becomes the new EOS character.
ibcPP20x00100: The board in the PP1 mode (Remote Parallel Polling Configuration).
ibcTIMING0x00110: Disable (Default).
ibcReadAdjust0x00130: No byte swapping.
ibcWriteAdjust0x00140: No byte swapping.
ibcSpollBit0x00160: Disable the SPOLL bit of the
ibcSendLLO0x00170: The GPIB LLO command is not sent while the device is connected by
ibcPPollTime0x00190: Use standard continue time (2μs) during parallel polling.
ibcEndBitIsNormalal0x001A 0: While the EOS is received, the END bit of the
ibcist0x0020Set the individual status (ist) bit of the board.
ibcRsv0x0021Set the status byte of the board sequential polling. Default: 0.
Options
(Value)Valid Values
1: The reading is stopped while the EOS character is read.
writing.
1: The EOI line is set to enable while the EOS character is sent during
writing.
1: Compare all EOS with 8 bits.
1: The board in the PP2 mode (Local Parallel Polling Configuration).
Default: 0.
1: Normal timing (2μs T1 delay).
2: High speed timing (500ns T1 delay).
3: Very high speed timing (350ns T1 delay).
The T1 delay is the GPIB source handshake timing.
1: Swap pairs of bytes during reading.
Default: 0.
1: Swap pairs of bytes during writing.
Default: 0.
1: Enable the SPOLL bit of the
Default: 0.
ibfind or ibdev.
1: The GPIB LLO command is sent while the device is connected by
ibfind or ibdev.
Default: 0.
1 ~ 17: Select a different continue time during parallel polling; the time
selected corresponds with the ibtmo timing value. Default: zero.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-15
Options
(Values)Returned Information
Set the current device primary address.
Set the current device secondary address.
Set the current device I/O timeout.
Set the data termination mode for writing.
0: Unnecessary addressing is not operated during device-level writing or
reading.
1: Addressing is operated continuously during the device-level writing or
reading.
0: Ignore the EOS character during reading.
1: The reading is stopped while the EOS character is read.
0: The EOI line is not set to enable while the EOS character is sent
during writing.
1: The EOI line is set to enable while the EOS character is sent during
writing.
0: Compare all EOS with 7 bits.
1: Compare all EOS with 8 bits.
Any eight-bit value. This byte becomes the new EOS character.
0 ~ 17: Set the waiting time of the driver for the sequential polling
response. The time is represented by ibtmo timing value.
Default: 11
0: When the EOS is received, the END bit of the ibsta is not set.
1: When the EOS is received, the END bit of the
ibsta is set. Default: 1.
DescriptionThis command opens and initializes a device descriptor. If ibdev cannot get a valid
device descriptor, -1 is returned; the ERR bit of the ibsta and the EDVR bit of the iberr
are set.
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibdev (int board_index, int pad, int sad,
int tmo, int send_eoi, int eosmode)
Visual Basic
ildev (ByVal bdid As Integer, ByVal pad As Integer,
ByVal sad As Integer, ByVal tmo As Integer,
ByVal eot As Integer, ByVal eos As Integer)
As Integer
- or -
call ibdev (ByVal bdid As Integer, ByVal pad As
Integer, ByVal sad As Integer, ByVal tmo As Integer,
ByVal eot As Integer, ByVal eos As Integer,
ud As Integer)
Parametersboard_index: the index of the device access board
pad: the device primary GPIB address
sad: the device secondary GPIB address
tmo: the I/O timeout value
eot: enable or disable the device EOI mode
eos: configure the device EOS character and device EOS modes
2-16Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Return ValueThe device descriptor or -1
Error CodesEARG, EDVR, ENEB
ibdma
DescriptionThis command enables or disables DMA. This function is not supported for the Model
KPCI-488LPA.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibdma (int ud, int v)
Visual Basic
ibdma (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibdma (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board descriptor
ibeot
dma: enable or disable DMA mode
Return ValueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, ENEB, EOIP
DescriptionThis command enables or disables the action that is setting GPIB EOI line to enable
while the I/O operation is completed. If the EOT mode is enabled, the EOI line is set to
enable while the last GPIB is written to bytes. Otherwise, there is no operation to be
performed while the last byte is sent.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibeot (int ud, int v)
Visual Basic
ileot (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibeot (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board or device descriptor
v: enable or disable eot mode
Return ValueThe value of the ibsta
Error CodesEDVR, ENEB, EOIP
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-17
DescriptionThis command configures the EOS termination mode or character.
NOTEDefining an EOS byte does not automatically send it when I/O writing is terminated; the user
must set the EOS byte after the data strings have been defined by the application.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibeot (int ud, int v)
Visual Basic
ibeos (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibeos (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board or device descriptor
v: The information of the EOS mode and character. If v is zero, the EOS configuration
is disabled. Otherwise, the low byte is the EOS character and the upper byte contains
the flags that define the EOS mode.
and the corresponding values of v.
Table 2-9 shows the different EOS configurations
Configure bit A and bit C to determine how to terminate the I/O reading. If bit A is set
and bit C is clear, the I/O reading is terminated when a byte that matches the low
seven bits of the EOS character is received. If both bit A and bit C are set, the I/O
reading is terminated when a byte matching the entire eight bits of the EOS character
is received.
Configure bit B and bit C to determine how to control the GPIB EOI line during
I/O writing. If bit B is set and bit C is clear, the EOI line is set to enable when a byte
that matches the low seven bits of the EOS character is written. If both bit B and bit C
are set, the EOI line is set to enable when a byte matching the entire eight bits of the
EOS character is written.
Table 2-9
EOS mode V value
EOS mode
Terminate reading when the
EOS is detected.
Through the write function,
set EOI with EOS.
Compare the entire eight bits
of the EOS byte rather than
the low 7 bits.
V Value
BitUpper ByteLow Byte
A00000100EOS character
B00001000EOS character
C00010000EOS character
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
2-18Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
ibfind
DescriptionThis command opens and initializes the GPIB board descriptor. The returned board
descriptor can be used in later commands. Similar to ibonl 1, ibfind performs a board
description initialization. Before the board is put offline by using ibonl 0, the descriptor
that is returned by ibfind is valid; -1 is returned if ibfind is unable to get a valid
descriptor. At the same time, the ERR bit of the ibsta and the EDVR bit of the iberr
are set.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibfind (const char *boardname)
Visual Basic
ibfind (ByVal boardname As String) As Integer
- or -
call ibfind (ByVal boardname As String, ud As
Integer)
Parametersboardname: board name; for example, gpib0
ibgts
Return ValueThe board descriptor or -1
Error CodesEBUS, ECIC, EDVR, ENEB
DescriptionThis command sets the board from active control status to standby control status.
ibgts sets the GPIB board as the standby control unit and releases the control of the
GPIB ATN line.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibgts (int ud, int shadow_handshake)
Visual Basic
ibgts (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibgts (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board descriptor
v: determines whether to handshake with receiver
Return ValueThe value of the ibsta
Error CodesEADR , EARG, ECIC, EDVR, ENEB, EOIP
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-19
DescriptionThis command sets or clears the board individual status (ist) bit for parallel polling.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibist (int ud, int ist)
Visual Basic
ibist (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibist (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board descriptor
v: shows whether to set or clear the ist bit
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
iblines
DescriptionReturns the GPIB control lines status. The low-order lines byte (bits 0 to 7) shows
that the GPIB interface has the capability to automatically detect the status of each
GPIB control line. The upper byte (bits 8 to 15) shows the status of the GPIB control
line. A description of each byte is listed in
To determine whether a GPIB line is controlled, complete the following steps:
1. Check the appropriate bit of the low byte to ensure the line can be monitored.
2. Check whether the corresponding bit of the upper byte can be monitored (the
appropriate bit of the low byte is 1).
If the checked bit of the upper byte is set (1), the corresponding line is in controlled
status; if the checked bit of the upper byte is clear (0), the corresponding line is not in
controlled status.
Table 2-10
iblines
765432 1 0
EOI ATN SRQ REN INF NRFD NDAC DAV
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
Table 2-10.
int iblines (int ud, short *line_status)
Visual Basic
iblines (ByVal ud As Integer, lines As Integer)
As Integer
- or -
call iblines (ByVal ud As Integer, lines As Integer)
2-20Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Parametersud: board descriptor
line_status: the status information of the returned GPIB control line
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
ibln
DescriptionThis command determines if there is an available device on bus.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibln (int ud, int pad, int sad,
short *found_listener)
Visual Basic
ibln (ByVal ud As Integer, ByVal pad As Integer,
ByVal sad As Integer, found_listener As Integer)
As Integer
ibloc
- or -
call ibln (ByVal ud As Integer, ByVal pad As Integer,
ByVal sad As Integer, found_listener As Integer)
Parametersud: board or device descriptor. The board tests for listeners if ud is a board descriptor.
ibln tests for listeners with the interface related with the device if ud is a device descriptor. If a listener is detected, a non-zero value is returned in the found_listener.
pad: device primary address (addressing value between 0 and 30)
sad: the device secondary address (addressing value is between 96 and 126,
NO_SAD or ALL_SAD. NO_SAD is no secondary addressing, only a primary addressing for example. ALL_SAD is set to test all secondary addresses)
found_listener: shows if there is a device available
Return ValueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, ENEB, EOIP
DescriptionIf a board is not in lockout status, ibloc sets the board in local control mode. If LOK
does not exist in the status word, ibsta, the board is in a lockout state. If a board is in
lockout, calling ibloc has no effect.
If the computer is used as an apparatus, ibloc is used to simulate a panel RTL
(Return to Local) switch.
All device-level commands automatically set the device to remote mode except the
Remote Enable (REN) line is not controlled by ibsre; ibloc is used to temporarily set
the device from remote mode to local mode before the next device-level command is
executed.
Support Level Board / device level
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-21
DescriptionThis command resets the board or device parameters to default settings and sets the
device online or offline. If the device or interface is set to offline, the board or device
descriptor is no longer effect. Once called, use ibdev or ibfind to access the board or
device.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
Parametersud: board or device descriptor
Return ValueThe value of the ibsta
Error CodesEARG, ENEB
ibnotify
DescriptionThis command uses the selected callback function to notify the user of one or more
int ibonl (int ud, int onl)
Visual Basic
ibonl (ByVal ud As Integer, ByVal onl As Integer)
As Integer
- or -
call ibonl (ByVal ud As Integer, ByVal onl As
Integer)
onl: online (1) or offline (0)
GPIB events. The re-synchronization handler is needed after the completion of the
asynchronous I/O operation; the global variable is passed to the callback function
while the operation of the I/O status is completed.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibnotify (int ud, int mask,
GpibNotifyCallback_t Callback, void *RefData)
2-22Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
- TIMOThe notify period is limited by the timeout period (see ibtmo)
- ENDEND or EOS is detected
- SRQISRQ signal is sent (only board level)
- RQSDevice requested service (only device level)
- CMPI/O completion
- LOKGPIB interface is in Lockout Status (only board level)
- REMGPIB interface is in Remote Status (only board level)
- CICGPIB interface is CIC (only board level)
- ATNAttention signal is sent (only board level)
- TACSGPIB interface is a talker (only board level)
- LACSGPIB interface is a listener (only board level)
- DTASGPIB interface is in Device Trigger Status (only board level)
- DCASGPIB interface is in Device Clear Status (only board level)
Description
If GPIB mask is non-zero, the events specified by mask are monitored by ibnotify.
while one or more of the events appears, the callback function is called. For boardlevel ibnotify call, all mask bits are valid except for ERR and RQS. For device-level
ibnotify call, CMPL, TIMO, END, and RQS are the only valid mask bits. If TIMO is set
in the notify mask, ibnotify calls the callback function even if no events have occurred
while the limited time is gone. If TIMO is not set in the notify mask, the callback
function is not called until one or more specified events occur.
Callback: the address callback function (Table 2-12 contains a description of the
function’s properties).
Table 2-12
Callback description (for ibnotify)
PropertyDescription
Prototypeint_std call Callback (int LocalUd,
int Localibsta, int LocalIberr,
long LocalIbcntl, void *RefData)
ParametersLocalUd: board or device descriptor
Localibsta: the ibsta value
LocalIberr: the iberr value
LocalIbcntl: the ibcntl value
RefData: the reference data for the callback function
defined by user
Return valuethe next mask of the notified GPIB event
Error codeEDVR
RefData: the reference data for the callback function defined by user
Return ValueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, ENEB, EOIP
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-23
If ud is a device descriptor, ibppc enables or disables the device response to parallel
polling. The addressed device sends the Parallel Poll Enable (PPE) or Parallel Poll
Disable (PPD) message. Valid parallel poll messages are 96 to 126 (hex 60 to hex 7E)
or zero corresponding to sent PPD.
If ud is a board descriptor, ibppc uses the parallel poll configuration value v to
perform a local parallel poll configuration. Valid parallel poll messages are 96 to 126
(hex 60 to hex 7E) or zero corresponding to send PPD. If there is no error happening
within the calling period, iberr maintains the previous value of the local parallel poll
configuration.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibppc (int ud, int v)
Visual Basic
ibppc (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibppc (ByVal ud As Integer, ByVal v As Integer)
DescriptionThis command reads data from a device to the indicated buffer.
The GPIB is addressed by ibrd, which reads count data bytes (count is the counting
value in the counter); when ud is the device descriptor, the count data bytes are
placed in the user buffer. The operation ends when the count data bytes have been
read or when END is read. If the count bytes reading does not finish before the
timeout period ends, the operation stops with an error. The actual number of
transferred bytes is returned in the global variable, ibcntl.
When ud is the board descriptor, count data bytes are read by ibrd and placed in the
user buffer. The GPIB has already been addressed by the board-level ibrd; the
operation ends when the count data bytes or END are read. If the count bytes reading
is not complete within the timeout period (or the board is not CIC, and CIC sends the
Device Clear message on the GPIB bus), the operation stops with an error. The
actual number of transferred bytes is returned in the global variable, ibcntl.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibrd (int ud, void *buf, long cnt)
Visual Basic
ibrda
ibrd (ByVal ud As Integer, buf As String,
ByVal cnt As Long) As Integer
- or -
call ibrd (ByVal ud As Integer, buf As String)
Parametersud: device descriptor
buf: the buffer that stores the data that is read from the GPIB
DescriptionThis command asynchronously reads data from a device to the designated buffer.
The GPIB is addressed by ibrda, which reads count data bytes (count is the counting
value in the counter); when ud is the device descriptor, the count data bytes are
placed in the user buffer. The operation ends when the count data bytes have been
read or when END is read. If the count bytes reading does not finish before the
timeout period ends, the operation stops with an error. The actual number of
transferred bytes is returned in the global variable, ibcntl.
Count data bytes are read by ibrda and placed in the user buffer when ud is the board
descriptor. The GPIB has already been addressed by the board-level ibrda; the
operation ends when the count data bytes or END are read. If the count bytes reading
is not complete within the timeout period (or the board is not CIC, and CIC sends the
Device Clear message on the GPIB bus), the operation stops with an error. The
actual number of transferred bytes is returned in the global variable, ibcntl.
The design purpose of the asynchronous I/O commands (ibcmda, ibrda, ibwrta) is
that applications can perform other non-GPIB operations while the I/O is in progress.
2-26Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Once the asynchronous I/O has begun, later GPIB commands are strictly limited; any
command that would interfere with the I/O in progress will not be allowed. In this case,
EOIP is returned by the driver.
When the I/O is complete, the application and the driver must be re-synchronized.
Use one of the following functions to re-synchronize:
ibwait: If the CMPL bit of the returned ibsta is set, the driver and application are resynchronized.
ibnotify: If the ibsta value sent to the ibnotify callback contains CMPL, the driver and
application are re-synchronized.
ibstop: The I/O is stopped, and the driver and application are re-synchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and application are re-
synchronized.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibrda (int ud, void *buf, long cnt)
Visual Basic
ibrdf
ibrda (ByVal ud As Integer, buf As String, ByVal cnt
As Long) As Integer
- or -
call ibrda (ByVal ud As Integer, buf As String)
Parametersud: device descriptor
buf: the buffer that stores the data that is read from the GPIB
cnt: the number of the bytes that is read from the GPIB
DescriptionThis command reads data from a device and saves it to a file.
The GPIB is addressed by ibrdf, which reads the data bytes from the GPIB device,
then saves them to a file (when ud is a device descriptor). The operation stops when
END is read. If the data transfer does not finish before the timeout period ends, the
operation stops with an error. The actual number of transferred bytes is returned in the
global variable, ibcntl.
Data bytes are read from the GPIB device by ibrdf, then saved to a file when ud is the
board descriptor. The GPIB has already been addressed by the board-level ibrdf; the
operation stops when END is read. If the data transfer is not complete within the
timeout period (or the board is not CIC, and CIC sends the Device Clear message on
the GPIB bus), the operation stops with an error. The actual number of transferred
bytes is returned in the global variable, ibcntl.
Support Level Board / device level
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-27
ibrpp (ByVal ud As Integer, ppr As Integer)
As Integer
- or -
call ibrpp (ByVal ud As Integer, ppr As Integer)
Parametersud: device descriptor
ppr: the parallel polling result
Return ValueThe value of the ibsta
Error CodesEBUS, ECIC, EDVR, ENEB, EOIP
DescriptionThis command sends the Interface Clear (IFC) message or Remote Enable (REN)
message to request or release the system control. The operations that request system
controller capability are not allowed if the board releases system control; when the
board requests system control, operations that request system controller capability
are allowed.
Support Level Board level
2-28Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
SyntaxMicrosoft C/C++ and Borland C++
int ibrsc (int ud, int v)
Visual Basic
ibrsc (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibrsc (ByVal ud As Integer, ByVal v As Integer)
Parametersud: device descriptor
v: 0: release system control; 1: request system control
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
ibrsp
DescriptionThis command performs sequential polling. The device is requesting service if bit 6 of
the response is set. If automatic sequential polling is enabled, the device has already
been polled and the previous status byte value is returned by ibrsp.
ibrsv
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibrsp (int ud, char *spr)
Visual Basic
ibrsp (ByVal ud As Integer, spr As Integer)
As Integer
DescriptionThis command enables the GPIB interface clear (IFC) line to allow at least 100ns
when the GPIB interface is the system controller by initializing the GPIB interface,
designating it as CIC, and activating the controller by setting ATN line .
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibsic (int ud)
Visual Basic
ibsic (ByVal ud As Integer) As Integer
- or -
ibsre
call ibsic (ByVal ud As Integer)
Parametersud: device descriptor
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP, ESAC
DescriptionThis command sets or clears the Remote Enable (REN) line. The Remote Enable
(REN) line is used by devices to choose local or remote modes of operation; ibsre
sets or clears the REN line. The GPIB REN line is enabled when the remote enable
line is set, and disabled when the remote enable line is cleared. A device cannot enter
remote mode before it receives its listen address and the REN is initiated.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibsre (int ud, int v)
Visual Basic
ibsre (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibsre (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board descriptor
v: Sets or clears REN line. 0: clear; 1: set
Return ValueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP, ESAC
2-30Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
ibstop
DescriptionThis command stops asynchronous I/O operation. If the ibsta command is used when
asynchronous I/O is operating, the error code EABO is returned to show the I/O was
successfully stopped.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibstop (int ud)
Visual Basic
ibstop (ByVal ud As Integer) As Integer
- or -
call ibstop (ByVal ud As Integer)
Parametersud: board or device descriptor
Return ValueThe value of the ibsta
Error CodesEABO, EBUS, EDVR, ENEB
ibtmo
DescriptionThis command sets the board or device timeout period. The timeout period is the
maximum continuous time allowed for synchronous I/O operation (ibrd and ibwrt for
example); or the maximum waiting time of ibwait or ibnotify that uses TIMO in the
mask. If the operation is not completed within the timeout period, the operation is
stopped and returns TIMO in ibsta.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibtmo(int ud, int v)
Visual Basic
ibtmo (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibtmo (ByVal ud As Integer, ByVal v As Integer)
Parametersud: board or device descriptor
v: timeout period value. The valid timeout values are shown in Table 2-13:
Table 2-13
ibtmo timeout
ConstantV ValueMinimum Timeout
TNONE0Disabled - no timeout period
T10μs110μs
T30μs230μs
T100μs3100μs
T300μs4300μs
T1ms51ms
T3ms63ms
T10ms710ms
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-31
DescriptionThis command sends the Group Execute Trigger (GET) message to a device.
ibwait
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibtrg (int ud)
Visual Basic
ibtrg (ByVal ud As Integer) As Integer
- or -
call ibtrg (ByVal ud As Integer)
Parametersud: device descriptor
Return ValueThe value of the ibsta
Error CodesEARG, EBUS, ECIC, EDVR, ENEB, EOIP
Descriptionibwait waits for one or more events described by mask (including TIMO) to occur. If
TIMO in the wait mask is set, ibwait returns when the timeout period has expired even
if no other GPIB events occur. Setting TIMO to zero returns the newest ibsta
immediately. If the TIMO in the wait mask is cleared, the function waits indefinitely for
a GPIB event (described by mask).
The present ibwait mask bits are the same as ibsta bits. Only the TIMO, END, RQS,
and CMPL are valid wait mask bits if ud is a device descriptor. Except for RQS, if ud
is a board descriptor, all wait mask bits are valid.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibwait (int ud, int mask)
2-32Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
SyntaxVisual Basic
ibwait (ByVal ud As Integer, ByVal mask As Integer)
As Integer
- or -
call ibwait (ByVal ud As Integer, ByVal mask As
Integer)
Parametersud: board or device descriptor
mask: GPIB events that can be monitored. The valid code values are shown in Table
2-14:
Table 2-14
ibwait valid mask codes
MaskBit Position Hex Value Description
ERR158000GPIB error
TIMO144000Mask timeout
END132000END or EOS is detected by GPIB board
SRQI121000Send SRQ signal (only board)
RQS (only device
level)
SPOLL10400Controller sequentially polls the board
EVENT9200A DTAS, DCAS, or IFC event occur
CMPL8100I/O completed
LOC780GPIB board is in Lockout Status
REM640GPIB board is in Remote Status
CIC520GPIB board is in CIC status
ATN410Send Attention signal
TACS38GPIB board as a talker
LACS24GPIB board as a listener
DTAS12GPIB board is in Device Trigger Status
DCAS01GPIB board is in Device Clear Status
11800Device requesting service
Return ValueThe value of the ibsta
Error CodesEARG, EBUS, ECIC, EDVR, ENEB, ESRQ
ibwrt
DescriptionThis command writes data from a buffer to a device.
When ud is a device descriptor, ibwrt addresses the GPIB and writes count data
bytes (cnt is the tallying value in the counter) from the board’s memory to the GPIB
device. The operation normally ends when cnt number of data bytes have been
written; if cnt number of bytes are not written completely during the timeout period, the
operation stops with an error. The number of bytes actually transferred is returned in
the global variable, ibcntl.
When ud is a board descriptor, the board-level ibwrt automatically writes cnt data
bytes from the buffer to the GPIB device. Normally, this operation ends when the cnt
number of data bytes are completely written; if cnt number of bytes are not completely
written during the timeout period (or, if the board is not CIC and CIC sends the Device Clear message on the GPIB bus), the operation stops with an error. The number of
bytes actually transferred is returned in the global variable ibcntl.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-33
DescriptionThis command asynchronously writes data from a buffer to a device .
When ud is a device descriptor, ibwrta addresses the GPIB and writes count data
bytes (cnt is the tallying value in the counter) from the board’s memory to the GPIB
device. The operation normally ends when the count data bytes have been written; if
the count bytes are not written completely during the timeout period, the operation
stops with an error. The number of bytes actually transferred is returned in the global
variable ibcntl.
When ud is a board descriptor, the board-level ibwrt automatically writes cnt data
bytes from the buffer to the GPIB device. Normally, this operation ends when the
count data bytes are completely written; if cnt bytes are not written during the timeout
period (or, if the board is not CIC and CIC sends the Device Clear message on the
GPIB bus), the operation stops with an error. The number of bytes actually transferred
is returned in the global variable ibcntl.
The design purpose of the asynchronous I/O commands (ibcmda, ibrda, ibwrta) is
that applications can perform other non-GPIB operations while the I/O is in progress.
Once the asynchronous I/O has begun, later GPIB commands are strictly limited; any
command that would interfere with the I/O in progress will not be allowed. In this case
the EOIP is returned by the driver.
When the I/O is complete, the application and the driver must be re-synchronized.
Use one of the following functions to re-synchronize:
ibwait: If the CMPL bit of the returned ibsta is set, the driver and application are resynchronized.
ibnotify: If the ibsta value sent to the ibnotify callback contains CMPL, the driver and
application are re-synchronized.
ibstop: The I/O is stopped, and the driver and application are re-synchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and application are re-
synchronized.
2-34Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibwrta (int ud, const void *buf, long cnt)
Visual Basic
ibwrta (ByVal ud As Integer, ByVal buf As String,
ByVal cnt As Long) As Integer
- or -
call ibwrta (ByVal ud As Integer, ByVal buf As
String)
DescriptionThis command writes data from a file to a device.
When ud is a device descriptor, ibwrtf addresses the GPIB and writes all data bytes
in filename to the GPIB device. The operation normally ends when all the data bytes
have been written; if all the bytes are not written during the timeout period, the
operation stops with an error. The number of bytes actually transferred is returned in
the global variable ibcntl.
When ud is a board descriptor, the board-level ibwrtf automatically writes all data
bytes in filename to the GPIB device. Normally, this operation ends when all the data
bytes are completely written; if all data bytes are not written during the timeout period
(or, if the board is not CIC and CIC sends the Device Clear message on the GPIB
bus), the operation stops with an error. The number of bytes actually transferred is
returned in the global variable, ibcntl.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibwrtf (int ud, const char *filename)
Visual Basic
ibwrtf (ByVal ud As Integer, ByVal filename As
String) As Integer
- or -
call ibwrtf (ByVal ud As Integer, ByVal filename
As String)
Parametersud: device descriptor
filename: the file name; the file contains the data written
Return ValueThe value of the ibsta
Error CodesEABO, EADR, EBUS, ECIC, EDVR
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-35
DescriptionThis command sets the Remote Enable (REN) line to enable, which places
SyntaxMicrosoft C/C++ and Borland C++
sets multiple devices in local mode, allowing local operation. If only the constant in
addrlist is NOADDR, the Remote Enable (REN) GPIB line is set to disable.
DescriptionThis command finds listening devices on the GPIB bus. This function tests all primary
addresses in padlist as follows: if a device exists in a given padlist, the device
primary address is stored in resultlist. Otherwise, the function tests all the secondary
addresses of the primary ones, and stores the addresses of any finding devices.
ibcntl includes the actual numbers of addresses stored in resultlist.
DescriptionThis command sequentially polls devices to determine which device is requesting
SyntaxMicrosoft C/C++ and Borland C++
padList: the list of the GPIB primary addresses ended by NOADDR
resultList: the list of all listening device addresses; the listening devices found by FindLstn function
maxNumResults: the maximum number of the resultList
service; the resulting byte is returned in ibcntl. ibcntl contains the index of the device
requesting service in addrList. If no device is requesting service, ETAB and the index
of NOADDR are individually returned in iberr and ibcntl.
void FindRQS (int board_desc, const Addr4882_t addressList[],
short *result)
Visual Basic
call FindRQS (ByVal ud As Integer, addressList ( )
As Integer, result As Integer)
Parametersboard_desc: board ID
addressList: the list of the GPIB primary addresses ended by NOADDR
result: the sequentially poll return byte of the device requesting service
2-38Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
PassControl
DescriptionThis command sends the Take Control (TCT) GPIB message to the device for
passing control to another GPIB device with control capability. The device changes to
Controller-In-Charge (CIC) status when the interface is no longer CIC status.
call PassControl (ByVal board_desc As Integer,
ByVal address As Integer)
Parametersboard_desc: board ID
address: the list of the GPIB primary addresses ended by NOADDR
Error CodesEAGR, EBUS, ECIC, EDVR, EOIP, ENEB
PPoll
DescriptionThis command performs parallel polling one time. The board sends a command to all
devices (see PPollConfig and PPollUnconfig). The controller can simultaneously
obtain one-bit status messages relayed from up to eight devices when parallel polling
is performed.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: board ID
Error CodesEBUS, ECIC, EDVR, EOIP, ENEB
PPollConfig
DescriptionThis command controls or releases the GPIB data line to configure the device to
SyntaxMicrosoft C/C++ and Borland C++
void PPoll (int board_desc, short *result)
Visual Basic
call PPoll (ByVal board_desc As Integer,
result As Integer)
result: the result of the parallel polling
respond to parallel polling. If lineSense is equal to the ist bit of the device, the
assigned GPIB data line is controlled in a parallel polling duration. Otherwise, the
assigned data line is not controlled in a parallel polling duration. The controller can
simultaneously obtain one-bit status messages related with it from up to eight devices
by a parallel polling.
void PPollConfig (int board_desc, Addr4882_t address,
int dataLine, int lineSense)
Visual Basic
call PPollConfig (ByVal ud As Integer,
ByVal address As Integer, ByVal dataLine As Integer,
ByVal lineSense As Integer)
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-39
DescriptionThis command reads data from a device. The RcvRespMsg function assumes that
SyntaxMicrosoft C/C++ and Borland C++
call PPollUnconfig (ByVal ud As Integer,
addressList ( ) As Integer)
addressList: the list of the device addresses ended by NOADDR
the interface is in the listen-active status and addresses a device as a talker. The
function reads data continuously, until either "count" data have been read or the
terminal condition is detected. If the terminal condition is DTOPend, the reading
action is stopped and the EOI line is set to enable while the STOPend is received.
Otherwise, the reading action is stopped while the eight-bit EOS character is detected.
Returns the actual number of transferred bytes in the global variable, ibcntl.
void RcvRespMsg (int board_desc, void *buffer,
long count, int termination)
Visual Basic
call RcvRespMsg (ByVal ud As Integer, buf As String,
ByVal termination As Integer)
Parametersboard_desc: board ID
buffer: the buffer for storing the read data
count: the number of read bytes
termination: the description of the data termination mode
DescriptionThis command reads data bytes from a device, and then stores them in the assigned
buffer. Receive the device address described by addressing to a talker, setting the
interface to a receiver, reading count data bytes from the device, and storing these
data bytes into the buffer. The operation is normally stopped when the count data
bytes have been read or the terminal condition is detected. If the terminal condition is
STOPend, the EOI line is set to enable while the STOPend byte is received.
Otherwise, the reading operation is stopped while the eight-bit EOS character is
detected. Returns the actual number of transferred bytes in the global variable, ibcntl.
SyntaxMicrosoft C/C++ and Borland C++
void Receive (int board_desc, Addr4882_t address,
void *buffer, long count, int termination)
Visual Basic
call Receive (ByVal ud As Integer,
ByVal addr As Integer, buf As String,
ByVal termination As Integer)
Parametersboard_desc: board id
address: the device address; the device is read by the function for data
buffer: the buffer that stores the read data
termination: device termination mode (STOPend or EOS character)
DescriptionThis command configures the device to be a talker and the interface to a receiver.
After the function ReceiveSetup, RcvRespMsg function is usually called to transfer
the data from the device to the interface. ReceiveSetup is helpful for multiple
RcvRespMsg calls. When ReceiveSetup is adopted, the re-addressing is not
necessary when each data block is received.
DescriptionThis command writes data bytes from the buffer to the device. The operation is
reset the GPIB by controlling the Remote Enable (REN) line and then controlling the
Interface Clear (IFC) line. Second, send the Universal Device Clear (DCL) GPIB message to clear all devices. Finally, send the "*RST\n" message to the address list,
addrlist, to complete resetting and initialization of the device.
call ResetSys (ByVal ud As Integer,
addressList ( ) As Integer)
addressList: the list of the device addresses ended by NOADDR
normally stopped until the count data bytes have been written. If eotmode is
DABend, the EOI line is set to enable while the final byte is sent. If eotmode is
NULLend, the EOI line is set to disable while the final byte is sent. If eotmode is
NLend, the EOI line is controlled while the final byte and the following new character
"\n" have been sent. Returns the actual number of transferred bytes in the global
variable, ibcntl.
2-42Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
SyntaxMicrosoft C/C++ and Borland C++
void Send (int board_desc, Addr4882_t address,
const void *buffer, long count, int eot_mode)
Visual Basic
call Send (ByVal ud As Integer,
ByVal addr As Integer, ByVal buf As String,
ByVal eot_mode As Integer)
Parametersboard_desc: board ID
address: the device address
buffer: the sent data bytes
count: data count
eot_mode: data termination mode (DABend, NULLend, or NLend)
DescriptionThis command sends GPIB commands. Returns the number of transferred command
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: board ID
Error CodesEABO, ECIC, EDVR, ENOL, EOIP, ENEB
SendDataBytes
DescriptionThis command sends data from the buffer to the device. The SendDataBytes function
bytes in the global variable, ibcntl.
void SendCmds (int board_desc, const void *cmdbuf,
long count)
Visual Basic
call SendCmds (ByVal ud As Integer,
ByVal cmdbuf As String)
cmdbuf: the sent command bytes
count: data count
assumes that the interface on the GPIB bus is in the talk-active status and already
addresses the devices as listeners. If eotmode is DABend, the EOI line is controlled
while the final byte is sent. If eotmode is NULLend, the EOIline is not controlled
while the final byte is sent. If eotmode is NLend, the EOIline is set to enable while
the final byte and the following new character "\n" have been sent. Returns the actual
number of transferred bytes in the global variable, ibcntl.
KPCI-488LPA-900-01 Rev. A / December 2008Return to Section Topics2-43
DescriptionThis command sends data bytes to multiple GPIB devices. The SendList function
addresses all devices listed in address list, addrlist, as listeners, addresses the
interface to talk, and then transfers the data from the buffer to the devices. If eotmode
is DABend, the EOIline is set to enable while the final byte is sent. If eotmode is
NULLend, the EOI line is set to disable while the final byte is sent. If eotmode is
NLend, the EOI line is set to enable while the final byte and the following new
character "\n" have been sent. Returns the actual number of transferred bytes in the
global variable, ibcntl.
SyntaxMicrosoft C/C++ and Borland C++
void SendList (int board_desc,
const Addr4882_t addressList[], const void *buffer,
long count, int eotmode)
Visual Basic
call SendList (ByVal ud As Integer,
addressList ( ) As Integer, ByVal buf As String,
ByVal term As Integer)
Parametersboard_desc: board ID
addressList: the list of the device addresses; the devices that send data bytes
buffer: the sent data bytes
count: data count
eotmode: data termination mode (DABend, NULLend, or NLend)
2-44Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
SendIFC
DescriptionThis command sends the Interface Clear command to reset GPIB. SendIFC is used
to be a part of GPIB initialization. The function forces the interface to Controller-inCharge of GPIB. At the same time, the function ensures that the devices connected
with it are not addressed and that the interface calls of the devices are in idle status.
SyntaxMicrosoft C/C++ and Borland C++
void SendIFC (int board_desc)
Visual Basic
call SendIFC (ByVal ud As Integer)
Parametersboard_desc: board ID
Error CodesENEB, ESAC, EDVR, EOIP
SendLLO
DescriptionThis command sends the Local Lockout (LLO) message to all devices. While the
LLO is to be effective, only the Controller-In-Charge can change device states by
sending appropriate GPIB messages. SendLLO is reserved for use in uncommon
local/remote situations. Under typical situations, SetRWLS is used to place a device
in remote with lockout.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: board ID
Error CodesEBUS, ECIC, ENEB, ESAC, EDVR, EOIP
SendSetup
DescriptionThis command configures the device to receive data. SendSetup sets the devices
SyntaxMicrosoft C/C++ and Borland C++
void SendLLO (int board_desc)
Visual Basic
call SendLLO (ByVal ud As Integer)
listed in addressList as listeners and sets the interface talk-active. After the
SendSetup call, SendDataBytes sends data from the interface to the devices. While
multiple SendDataBytes calls are used for transferring data, the address setting
capability of SendSetup is especially useful, since each device does not tneed to be
addressed while each data block is transferred.
DescriptionThis command configures the device to lockout status of remote control mode.
SetRWLS sets the devices listed in addrlist to remote control mode by controlling the
Remote Enable (REN) GPIB line. Then, the LLO GPIB message sets the devices to lockout status. Before the Controller-In-Charge calls EnableLocal to release Local
Lockout, the user can not locally operate these devices.
DescriptionThis command detects the current status of the GPIB Service Request (SRQ) line. If
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: board ID
Error CodesEDVR, EOIP, ENEB
TestSys
DescriptionThis command causes devices to process self tests. TestSys sends the "TST?"
the SRQ is controlled, the result contains a non-zero value. Otherwise, the result
contains a zero value. TestSRQ is used to get the current status of GPIB SRQ line.
WaitSRQ is used to wait until the device controls the GPIB SRQ line.
void TestSRQ (int board_desc, short *result)
Visual Basic
call TestSRQ (ByVal ud As Integer, result As Integer)
result: the status of the SRQ line
message to the devices. The "TST?" message makes the devices test themselves
individually. Then it reads sixteen-bit self-test results from the devices. The self test
result 0\n shows that the device passed its self test (if the self test result is not 0\n, it
means that the device did not pass its self test). Refer to the documents that came
with the device to determine cause of the failed self test. If TestSys does not return Error (i.e., the ERR bit is not set in ibsta), the failure number of the self tests is
contained in ibcntl. Otherwise, the meaning of the ibcntl depends on the returned
failure. If the device does not send a response in a limited time, then the test result, ?,
is reported, and the error EABO is returned.
2-46Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
Model KPCI-488LPA GPIB Controller Interface Card User’s ManualSection 2: NI Command Compatible Functions
SyntaxMicrosoft C/C++ and Borland C++
void TestSys (int board_desc, Addr4882_t *addrlist,
short resultList[])
Visual Basic
call TestSys (ByVal ud As Integer,
addrlist ( ) As Integer, resultList ( ) As Integer)
Parametersboard_desc: board ID
addrlist: the list of the device addresses ended by NOADDR
resultList: the list of the self test results; each test item corresponds to each address listed in addrlist
DescriptionThis command sends the Group Execute Trigger (GET) GPIB message to a device.
If the address is constant NOADDR, the GET messages are sent to the devices that
are currently listen-active on the GPIB bus.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: board ID
Error CodesEARG, EBUS, EDVR, ECIC, EOIP, ENEB
TriggerList
DescriptionThis command sends the Group Execute Trigger (GET) GPIB message to multiple
SyntaxMicrosoft C/C++ and Borland C++
void Trigger (int board_desc, Addr4882_t address)
Visual Basic
call Trigger (ByVal ud As Integer,
ByVal address As Integer)
address: the device address; the device to be triggered
devices. If there is only constant NOADDR in the addrlist, no device is addressed
and the GET message is sent to the devices that are currently listen-active on the
GPIB bus.
DescriptionThis command waits until the device controls the GPIB SRQ line. When WaitSRQ
returns, the result contains a non-zero value if the SRQ line in controlled. Otherwise
the result contains a zero value. Get the current status of the GPIB SRQ line by using
TestSRQ. Use WaitSRQ to wait before the SRQ line can be controlled.
SyntaxMicrosoft C/C++ and Borland C++
void WaitSRQ (int board_desc, short *result)
Visual Basic
call WaitSRQ (ByVal ud As Integer,
result As Integer)
Parametersboard_desc: board ID
result: the status of the SRQ line
Error CodesEDVR, EOIP, ENEB
2-48Return to Section TopicsKPCI-488LPA-900-01 Rev. A / December 2008
In this section:
Top icPa ge
NI command compatible status codes ......................................... A-2
This section contains information about possible error codes produced when using the National
Instruments™ (NI)1 command compatible functions. All commands update global status word ibsta
which contains the GPIB status and the message from the user's GPIB hardware. After every
command, the user can use the ERR bit of the ibsta to detect errors. The ibsta is a
sixteen-bit word. A bit value equal to one means the condition occurred while a bit value equal to zero
means the condition did not occur.
Tab l e A- 1
NI command compatible status codes
Mnemonic Position Hex Ty peDescription
ERR158000 device, board GPIB error
TIMO144000 device, board Timeout
END132000 device, board END or EOS has been detected
SRQI121000 boardSRQ interrupt occurred
RQS11800deviceDevice requesting service
SPOLL10400boardBoard has been sequentially polled by
controller
EVENT9200boardDCAS, DTAS, or IFC event occurred
CMPL8100device, board I/O completion
LOK780boardLockout status
REM640boardRemote status
CIC520boardControl-In-Charge
ATN410boardSend attention message
TACS38boardTalk status
LACS24boardListen status
DATS12boardDevice trigger status
DCAS01boardDevice clear status
1. National Instruments™ and NI are trademarks of the National Instruments Corporation.
NI command compatible function error codes are listed in the following table. Note that, the error
variable is meaningful only when the ERR bit of the status variable, ibsta, is placed. Click the error
mnemonic, and you can obtain a detailed description and the solution for each error.
Tab l e A- 2
NI command compatible function error codes
Error Mnemonic iberr Value Meaning Description
EDVR0OS error
ECIC1Function requests GPIB board as CIC
ENOL2No listen device on the GPIB bus
EADR3GPIB board addressing error
EARG4Invalid argument
ESAC5GPIB board is not on the system controller requesting
status
EABO6I/O operation is aborted (timeout)
ENEB7GPIB board does not exit
EDMA8DMA error
EOIP10Asynchronous I/O in progress
ECAP11The operation is not performed
EFSO12File system error
EBUS14GPIB bus error
ESTB15The status byte queue of the sequential polling overflow
ESRQ16SRQ is stuck in ON state
ETAB20Table problem
List all control settings, describe problem and check boxes that apply to problem.
❏ Intermittent❏ Analog output follows display❏ Particular range or function bad; specify
❏ IEEE failure❏ Obvious problem on power-up❏ Batte ries and fuses are OK
❏ Front panel operational❏ All ranges or functions are bad❏ Checked all cables
Display or output (check one)
❏ Drifts❏ Unable to zero
❏ Unstable❏ Will not read applied input
❏ Overload
❏ Calibration only❏ Certi fi cate of cali bration required
❏ Data required
(attach any additional sheets as necessary)
Show a block diagram of your measurement system including all instruments connected (whether power is turned on
or not). Also, describe signal source.
Where is the measurement being performed? (factory, controlled laboratory, out-of-doors, etc.)
What power line voltage is used?Ambient temperature?°F
Relative humidity?Other?
Any additional information. (If special modifications have been made by the user, please describe.)
Be sure to include your name and phone number on this service form.
12/06
12/06
Specifications are subject to change without notice.
All Keithley trademarks and trade names are the property of Keithley Instruments, Inc.
All other trademarks and trade names are the property of their respective companies.