Section 1: Keithley Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Introduction
This section contains information about Keithley Instruments command-compatible functions.
Refer to Section 2 for information about the National Instruments (NI™)
functions.
NOTERefer to Section 2 for NI Command-Compatible Functions.
If you have any questions, please contact your local Keithley Instruments representative or call
Keithley Instruments corporate headquarters (toll-free inside the U.S. and Canada only) at
1-888-KEITHLEY (1-888-534-8453), or from outside the U.S. at +1-440-248-0400. For worldwide
contact numbers, visit our website at www.keithley.com.
Using Keithley command-compatible functions
Microsoft® Visual Basic® version 6.0 and .NET
To create a Keithley command-compatible application on Microsoft® Windows® XP/2000/Vista™
operating systems, use the the API and Microsoft
Step 1: Enter Visual Basic and open or create a project
To create a new project:
®
Visual Basic® to perform the following steps:
1
command-compatible
After opening Visual Basic, select File > New Project.
To use an existing project:
1.After opening Visual Basic, select File > Open Project. The Open Project dialog box
displays (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.
1. National Instruments™ and NI™ are trademarks of the National Instruments Corporation.
1-2Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 1: Keithley Command-Compatible Functions
Step 2: Include function declarations and constants file
If it is not already included in the project, add the IEEEVB.BAS file (for Visual Basic version 6.0) or
the GPIB_vb.vb file (for Visual Basic .NET) file as a module to your project. All Keithley
command-compatible function declarations and constants are contained in this file, which is used
to develop user self-measurement applications.
Step 3: Design the application interface
Add elements (for example, a command button, list box, or text box) 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, then 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 View > Properties
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 an event code; the code module will display.
2.Add new codes as needed. All functions that are declared in IEEEVB.BAS or GPIB_vb.vb
(depending upon the Visual Basic version used) can be called to perform data acquisition
operations (for details, refer to Keithley command-compatible function reference).
Step 6: Run your application
To run the application, perform one of the following actions:
•Press F5
•Select Run > Start
or
•Click the Start icon on the toolbar
KI488-901-01 Rev. A / March 2010Return to Section Topics1-3
Section 1: Keithley Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Microsoft Visual C/C++
To create a Keithley command-compatible library application using the Keithley
command-compatible function library (which is CEC command-compatible) and Microsoft Visual
C/C++ on a Windows XP/2000 operating system, follow these steps:
Step 1: Enter Visual C/C++ and open an existing project or create a new project
NOTEThe project can be a new project, or you can use an existing project.
Step 2: Include function declarations and constants file (IEEE-C.H)
Include the IEEE-C.H file in the Visual 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 the
IEEE-C.H file. 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++ version 4.0 and later).
3.Remember to link the Keithley command-compatible library ieee_32m.lib.
Microsoft Visual C#
Step 1: Enter Visual C# and open an existing project or create a new project
Step 2: Include the function declarations and constants file (GPIB_CS.cs)
Add the GPIB_CS.cs file to your Visual C# project. All Keithley command-compatible functions
are contained in the file.
Step 3: 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 an event code; the code module displays.
2.Add the new code, as needed. All functions that are declared in the GPIB_CS.cs file can
be called to perform data acquisition operations (refer to the Keithley command-compatible
function reference for details).
Step 4: Run your application
To run the application, perform one of the following actions:
• Press F5
1-4Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 1: Keithley Command-Compatible Functions
• Select Run > Start
or
• Click the Start icon on the toolbar.
Keithley command-compatible function reference
This section contains a detailed description of Keithley Instruments command-compatible library
functions, including the compatible library data types and function reference.
GPIBBOARDPRESENT
DescriptionVerifies whether 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: GPIB board is not installed
BOARDSELECT
DescriptionDesignates which board is the active board.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard: The board number; valid values are 0 to 3
ENTER
DescriptionReads data from a specified device.
SyntaxMicrosoft C/C++ and Borland C++
1: GPIB board is installed
void boardselect (long int bd)
Visual Basic
call boardselect (ByVal board As Long)
long int enter (char *buf, unsigned long maxlen,
unsigned long *len, long int addr,
long int *status)
Visual Basic
call enter(buf As String, maxlen As Integer,
len As Integer, addr As Integer, status As Integer)
KI488-901-01 Rev. A / March 2010Return to Section Topics1-5
Section 1: Keithley Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Parametersbuf: The buffer storing the received data
maxlen: The maximum bytes of data to receive; 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
FEA TURE
DescriptionReturns 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)
IEEEListener0Verifies that ListenerPresent function is supported by
IEEEIOBASE100The board’s I/O base address
IEEETIMEOUT200The board’s I/O timeout setting
IEEEINPUTEOS201The current input EOS character setting
IEEEOUTPUTEOS1202The current output EOS character 1 setting
IEEEOUTPUTEOS2203The current output EOS character 2 setting
IEEEBOARDSELECT204The current active board number
Return valueThe value of the feature or setting
INITIALIZE
DescriptionOpens 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 TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 1: Keithley Command-Compatible Functions
LISTENERPRESENT
DescriptionChecks for a specified listener on the GPIB system.
SyntaxMicrosoft C/C++ and Borland C++
char listener_present(long int addr)
Visual Basic
ListenerPresent (ByVal addr As Long) As Long
Parametersaddr: The listener address to check
Return value0: The specified listener is not present
1: The specified listener is present
PPOLL
DescriptionPerforms a parallel poll and reads the status of devices.
SyntaxMicrosoft C/C++ and Borland C++
int ppoll (char *poll)
Visual Basic
Parameterspoll: Returned parallel polling status
RARRA Y
DescriptionReceives a block of binary data (up to 64K) from a device defined as the talker.
SyntaxMicrosoft C/C++ and Borland C++
Parametersbuf: The buffer storing the received binary data
Return value0: Read data successfully
call ppoll(poll As Integer)
The GPIB addressing must be performed using the TRANSMIT function.
long int rarray (void *buf,
unsigned long count, unsigned long *len,
long int *status)
Visual Basic
call rarray(buf As Variant, ByVal count As Long,
l As Integer, status As Integer)
count: The maximum data bytes; valid value is 0 to 65535
len: Returns the actual number of received data bytes
8: Timeout error
32: Data transfer terminated with EOI
RECEIVE
DescriptionReads data from a specified device, but does not address a talker. The GPIB
addressing must be performed using the TRANSMIT function.
SyntaxMicrosoft C/C++ and Borland C++
KI488-901-01 Rev. A / March 2010Return to Section Topics1-7
Section 1: Keithley Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
long int receive (char *buf, unsigned long maxlen,
unsigned long *len, long int *status)
Visual Basic
call receive (buf As String, maxlen As Integer,
len As Integer, status As Integer)
Parametersbuf: The buffer storing the received data
maxlen: Sets maximum bytes of data to receive
len: Returns the actual number of received data bytes
Return value0: Read data successfully
8: Timeout error
SEND
DescriptionSends commands to a specified GPIB device.
SyntaxMicrosoft C/C++ and Borland C++
long int send (long int addr, char *buf,
unsigned long maxlen, long int *status)
Parametersaddr: The listener address
Return value0: Data sent successfully
SETINPUTEOS
DescriptionSets the terminating character for input data transfer.
SyntaxMicrosoft C/C++ and Borland C++
Parameterseos_c: The terminating character for input data transfer
Visual Basic
call send(addr As Integer, buf As String,
status As Integer)
buf: The buffer storing the data to send
maxlen: Sets the maximum number of data bytes to send
8: Timeout error
void setinputEOS (long int eos_c)
Visual Basic
call setinputEOS (ByVal eos_c As Long)
SETOUTPUTEOS
DescriptionSets the terminating characters for output data transfer.
SyntaxMicrosoft C/C++ and Borland C++
void setoutputEOS (long int e1, long int e2)
1-8Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 1: Keithley Command-Compatible Functions
Visual Basic
call setoutputEOS (ByVal e1 As Long, ByVal e2 As Long)
Parameterse1: The first terminating character for output data transfer
e2: The second terminating character for output data transfer
SETTIMEOUT
DescriptionSets the maximum duration allowed for a read/write operation (timeout period).
SyntaxMicrosoft C/C++ and Borland C++
void settimeout (unsigned long int timeout)
Visual Basic
call settimeout (ByVal timeout As Long)
Parameterstimeout: The timeout value in milliseconds (ms)
SPOLL
DescriptionPerforms serial polling and reads the specified device’s status.
SRQ
SyntaxMicrosoft C/C++ and Borland C++
long int spoll (long int addr, char *poll,
long int *status)
Visual Basic
call spoll(ByVal addr As Integer, poll As Integer,
status As Integer)
Parametersaddr:The address of the device to poll
poll: Returns the result of serial polling
Return value0: Data sent successfully
8: Timeout error
DescriptionChecks for device service requests.
SyntaxMicrosoft C/C++ and Borland C++
char srq(void)
Visual Basic
srq ( ) As Long
Return value0: The device is not requesting service
1: The device is requesting service
T ARRAY
DescriptionSends a block of binary data from memory to the devices defined as listeners;
GPIB addressing must be performed using the TRANSMIT function.
SyntaxMicrosoft C/C++ and Borland C++
KI488-901-01 Rev. A / March 2010Return to Section Topics1-9
Section 1: Keithley Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
long int tarray (void *buf,
unsigned long count, long int eoi,
long int *status)
Visual Basic
call tarray (buf as variant, ByVal count As Long,
ByVal eoi As Integer, status As Integer)
Parametersbuf: The buffer storing the data to send
count: The maximum number of data bytes to transmit
2-2Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Introduction
This section contains information about the National Instruments (NI™)1 command-compatible
functions and how to use them, as well as a reference section containing syntax examples
(Microsoft
command-compatible status codes and NI command-compatible function error codes.
NOTERefer to Section 1 for Keithley Command-Compatible Functions.
If you have any questions, please contact your local Keithley Instruments representative or call
Keithley Instruments corporate headquarters (toll-free inside the U.S. and Canada only) at
1-888-KEITHLEY (1-888-534-8453), or from outside the U.S. at +1-440-248-0400. For worldwide
contact numbers, visit our website at www.keithley.com.
®
Visual C/C++, Visual Basic
®
, and so on). Appendix A contains information about NI
Using NI command-compatible functions
This section provides the fundamentals of building applications on Microsoft® Windows® XP/2000/
™
operating systems using NI command-compatible functions and either Microsoft® Visual
Vista
®
or Microsoft® Visual C/C++.
Basic
Microsoft Visual Basic version 6.0 and .NET
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
To create a new project:
After opening Visual Basic, select File > New Project.
To use an existing project:
1.After opening Visual Basic, select File > Open Project. The Open Project dialog box
displays (see Figure 2-1).
1. National Instruments™ and NI™ are trademarks of the National Instruments Corporation.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-3
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Figure 2-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
If it is not already included in the project, add the GPIB.BAS file (for Visual Basic 6.0) or GPIB.vb
file (for Visual Basic.NET) file. All NI command-compatible function declarations and constants
that you will use to develop applications are contained in this file.
Step 3: Design the application interface
Add elements (for example, a command button, list box, or text box) 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, then 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 View > Properties
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 display.
2.Add new code as needed. All functions that are declared in the GPIB.BAS or GPIB.vb files
(depending upon the Visual Basic version used) can be called to perform operations (for
details, refer to IEEE-488 device-level functions, Table 2-1 through Table 2-4).
2-4Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Step 6: Run your application
To run the application, perform one of the following actions:
•Press F5
•Select Run > Start
or
•Click the Start icon on the toolbar
Microsoft Visual C/C++
To create an application with NI command-compatible functions and Microsoft Visual C/C++, follow
these steps:
Step 1: Enter Visual C/C++ and open an existing project or create a new project
NOTEThe project can be a new project, or you can use an existing project.
Step 2: Include the function declarations and constants file (GPIB.H)
Include GPIB.H in the Visual 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 the
GPIB.H file. 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 later).
3.Remember to link the NI command-compatible import library GPIB-32.lib.
Microsoft Visual C#
Step 1: Enter Visual C# and open an existing project or create a new project
Step 2: Include the function declarations and constants file (GPIB.cs)
Add the GPIB.cs file to your Visual C# project. All NI command-compatible functions are
contained in the file.
Step 3: 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 an event code; the code module displays.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-5
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
2.Add the new code, as needed. All functions that are declared in GPIB.cs can be called to
perform data acquisition operations (see NI command-compatible function reference for
details).
Step 4: Run your application
To run the application, perform one of the following actions:
• Press F5
• Select Run > Start
or
• Click the Start icon on the toolbar.
Overview of NI command-compatible functions
The NI command-compatible functions are grouped into three classes:
Returns the current value of the selected configuration item.
Assigns the access board of the designated device.
Sends the GPIB selected device clear (SDC) message to the designated
device.
Sets the value of the selected configuration item.
Opens and initializes a device descriptor.
Configures the EOS termination mode or character.
Enables or disables the action that sets the GPIB EOI line to enable while
the I/O operation completes.
Checks if there is an available device on the bus.
Sets the device to local control mode.
Sets the device online or offline.
Sets a device primary GPIB address.
Passes controller-in-charge (CIC) status to another GPIB device that has
Reads data from a device to the indicated buffer.
Reads data from a device to the indicated buffer asynchronously.
Reads data from a device to a file.
Reads data from a device to the indicated buffer.
Reads data from a device to the indicated buffer asynchronously.
Performs parallel polling.
Performs sequential polling.
Sets or disables a device secondary GPIB address.
Stops the asynchronous I/O operation.
2-6Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Sets the board or device timeout period.
Sends the group execute trigger (GET) message to a device.
Monitors events until one or more events occur that are described by mask
or that delay operating.
Writes data from a buffer to a device.
Writes data from a buffer to a device asynchronously.
Writes 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 sets the GPIB EOI line to enable while
the I/O operation completes.
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 for 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.
ibrppPerforms parallel polling.
ibrscSends an interface clear (IFC) message or remote enable (REN) message
to request or release the system control.
ibrsvRequests service and changes the sequential polling status byte.
ibsadSets or disables a board secondary GPIB address.
ibsicSets the GPIB interface clear (IFC) line to enable at least 100 ns if the
GPIB interface is the system controller.
ibsreSets or clears the remote enable (REN) line.
ibstopStops the asynchronous I/O operation.
ibtmoSets the board timeout period.
ibwaitMonitors events until one or more events occur that are described by mask
or that delay operating.
ibwrtWrites data from a buffer to a device.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-7
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Polls one or more devices sequentially.
Sends the selected device clear (SDC) GPIB message to clear
the selected device.
Clears multiple devices.
Sends go to local (GTL) GPIB message to multiple devices to
allow local operation of the devices.
Sets remote enable (REN) line to allow remote programming of
devices.
Finds listening devices on the GPIB bus.
Sequentially polls devices to determine which device is requesting
service.
Sends take-control (TCT) GPIB message, allowing control to pass
to another GPIB device with control capability.
Performs parallel polling once.
Controls or releases GPIB data line to configure the device to
respond to parallel polling.
Removes configuration that allows device to respond to parallel
polling.
Reads data from a device.
Sequentially polls a device.
Reads data bytes from a device and then stores them in the
assigned buffer.
Configures device and interface to a talker and a receiver.
Resets and initializes the devices.
Writes data bytes from the buffer to the device.
Sends GPIB commands.
Sends data from the buffer to the device.
Sends the interface clear command to reset GPIB.
Sends data bytes to multiple GPIB devices.
Sends the local lockout (LLO) message to all devices.
Configures device to receive data.
Configures device to lockout status of remote-control mode.
Detects current status of the GPIB service request (SRQ) line.
Causes devices to process self tests; sends the "TST?" message
to the devices.
Sends group execute trigger (GET) GPIB message to a device.
Sends group execute trigger (GET) GPIB message to multiple
devices.
Waits until the device controls the GPIB SRQ line.
2-8Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Data types
The GPIB.BAS file 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 Visual C/C++, Visual Basic, and Delphi.
These data types are not defined in either the GPIB.BAS or GPIB.PAS files (they are listed for
reference).
Table 2-4: Data types
Type
Visual C/C++
(32-bit
Type name DescriptionRange (approximate)
U88-bit ASCII
character
I1616-bit signed integer -32768 to 32767ShortIntegerWord
U16
Addr4882_t
I32 ssize_t32-bit signed integer -2147483648 to
U32 size_t32-bit unsigned
F3232-bit single-
F6464-bit double-
16-bit unsigned
integer
integer
precision floating-
point
precision floating-
point
0 to 255Unsigned
0 to 65535Unsigned shortNot
2147483647
0 to 4294967295Unsigned longNot
-3.402823E38 to
3.402823E38
-1.797683134862315E308
to 1.797683134862315E309
compiler)Visual Basic Byte
ByteSmall
character
supported;
placed by I16
LongLongCardinal
supported;
placed by I32
FloatSingleDouble
DoubleDoubleDouble
integer
Long
integer
Single
NI command-compatible function reference
Use this section as a function reference for NI command-compatible functions. Refer to Section 1
for information about 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)
KI488-901-01 Rev. A / March 2010Return to Section Topics2-9
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
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
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.
ibaSRE0x000B0: While the board becomes the system controller, the GPIB REN line
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 configuration).
ibaTIMING0x0011The current board bus timing.
ibaDMA0x00120: DMA is not used for GPIB transfer.
ibaSpollBit0x00160: Disable the SPOLL bit of the ibsta.
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.
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.
1: The board in the PP2 mode (local parallel polling configuration).
1: Normal timing (2 μs T1 delay).
2: High speed timing (500 ns T1 delay).
3: Very high-speed timing (350 ns T1 delay).
1: DMA is used for GPIB transfer.
1: Enable the SPOLL bit of the ibsta.
2-10Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
ibaSendLLO0x00170: The GPIB LLO command is not sent while the device is
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
connected by ibfind or ibdev.
1: The
GPIB LLO command is sent while the device is connected
ibfind or ibdev.
by
1 to 17 (approximate): Use different continue time during parallel
polling; time corresponds to the
and 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.
ibtmo timing value.
ibsta is set only when the EOI or both EOI
Table 2-6: ibask device configuration p arameter 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
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 ibsta is set only when the EOI or both EOI and
ibaBNA0x0200The index of the GPIB access board for the assigned device
Options
(values)Returned information
set to enable.
1: After termination of the writing operation, the GPIB EOI line is set to
enable.
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.
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.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-11
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
ibbna
DescriptionThis command assigns the device unit descriptor to the board name.
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
ibcac
DescriptionSets the assigned GPIB board to be the active controller by setting the ATN line to
enable. The GPIB board must be the controller-in-charge (CIC) 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
v: Either synchronous or asynchronous control
0: Asynchronously
1: Synchronously
Return valueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, EOIP, ENEB
2-12Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
ibclr
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
ibcmd
DescriptionSends 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)
Parametersud: Device unit descriptor
buf: The buffer contains the sent command string
cnt: The number of the command bytes; the command bytes that are to
be sent
Return valueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, EOIP, ENEB, EABO, ENOL
ibcmda
DescriptionThis command sends GPIB commands asynchronously. Command words are
used to 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.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-13
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
The asynchronous I/O commands (ibcmda, ibrda, ibwrta) are designed so
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
resynchronized.
Use one of the following functions to resynchronize:
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 resynchronized.
ibstop: The I/O is stopped, and the driver and application are resynchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and application
are resynchronized.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
int ibcmda (int ud, const void *cmd, long cnt)
SyntaxVisual Basic
Parametersud: Device unit descriptor
Return valueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, EOIP, ENEB, EABO, ENOL
ibconfig
DescriptionThis command sets the value of the selected configuration item.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
idcmda (ByVal ud As Integer, ByVal buf As String,
ByVal cnt As Long) As Integer
- or -
call ibcmda (ByVal ud As Integer, ByVal buf As
String)
buf: The buffer contains the sent command string
cnt: The number of the command bytes; the command bytes to be sent
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)
2-14Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
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)
ibcPAD
ibcSAD
ibcTMO
ibcEOT
ibcPPC
ibcAUTOPOLL
ibcSC
ibcSRE
ibcEOSrd
ibcEOSwrt
ibcEOScmp
ibcEOSchar
ibcPP2
ibcTIMING
ibcReadAdjust
ibcWriteAdjust
ibcSpollBit
Options
(value)Valid values
0x0001Set the board current primary address.
0x0002Set the board current secondary address.
0x0003Set the board current I/O timeout.
0x0004Set the data termination mode for writing.
0x0005Configure the board for parallel polling.
Default: 0.
0x00070: Disable the automatic sequential polling.
1: Enable the automatic sequential polling.
0x000ARequest or release system control. The same as ibrsc.
0x000BControl the remote enable (REN) line. The same as ibsre.
Default: 0.
0x000C0: Ignore the EOS character during reading.
1: The reading is stopped while the EOS character is read.
0x000D0: 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.
0x000E0: Compare all EOS with 7 bits.
1: Compare all EOS with 8 bits.
0x000FAny 8-bit value. This byte becomes the new EOS character.
0x00100: The board in the PP1 mode (remote parallel-polling
configuration).
1: The board in the PP2 mode (local parallel-polling configuration).
Default: 0.
0x00110: Disable.
1: Normal timing (2 μs T1 delay).
2: High-speed timing (500 ns T1 delay).
3: Very high-speed timing (350 ns T1 delay).
Default: 0.
The T1 delay is the GPIB source handshake timing.
0x00130: No byte swapping.
1: Swap pairs of bytes during reading.
Default: 0.
0x00140: No byte swapping.
1: Swap pairs of bytes during writing.
Default: 0.
0x00160: Disable the SPOLL bit of the ibsta.
1: Enable the SPOLL bit of the ibsta.
Default: 0.
KI488-901-01 Rev. A / March 2010Return to Section Topics2-15
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
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 8-bit value. This byte becomes the new EOS character.
0 to 17 (approximate): 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.
ibdev
DescriptionOpens 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.
2-16Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
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
ibdma
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
Return valueThe device descriptor or -1
Error CodesEARG, EDVR, ENEB
DescriptionThis function, which is not supported for the Model KPCI-488LP, enables or
disables DMA.
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
dma: Enable or disable DMA mode
Return valueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, ENEB, EOIP
KI488-901-01 Rev. A / March 2010Return to Section Topics2-17
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
ibeot
DescriptionEnables 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
ibeos
Return valueThe value of the ibsta
Error CodesEDVR, ENEB, EOIP
DescriptionConfigures the EOS termination mode or character.
NOTEDefining an EOS byte does not automatically send it when I/O writing is terminated; you
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: EOS mode and character information.
If v = zero:The EOS configuration is disabled.
If v is not = 0: Lower byte is the EOS character; upper byte
contains flags that define the EOS mode. Table 2-9
2-18Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
shows the different EOS configurations and the
corresponding values of v.
Configure Bits A and C to set I/O reading termination:
If Bit A = set, Bit C = clear: The I/O reading terminates when a byte
matching the low seven bits of the EOS character is received.
If Bit A = set, Bit C = set: The I/O reading terminates when a byte
matching all eight bits of the EOS character is received.
Configure Bits B and C to set GPIB EOI line control during I/O writing:
If Bit B = set, Bit C = clear: The EOI line is enabled when a byte
matching the low seven bits of the EOS character is written.
If Bit B = set, Bit C = set: The EOI line is enabled when a byte
matching all eight bits of the EOS character is written.
Table 2-9: EOS mode v value
v value
ibfind
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 seven bits.
BitUpper byteLow byte
A00000100EOS character
B00001000EOS character
C00010000EOS character
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
DescriptionOpens and initializes the GPIB board descriptor, which can be used in later
commands. Similar to the ibonl 1 command, the ibfind command performs a
board description initialization. Before the board is put offline by using the ibonl
0 command, 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)
KI488-901-01 Rev. A / March 2010Return to Section Topics2-19
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Parametersboardname: Board name, for example, gpib0
Return valueThe board descriptor or -1
Error CodesEBUS, ECIC, EDVR, ENEB
ibgts
DescriptionSets the board from active control status to standby control status. The ibgts
command 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)
ibist
Parametersud: Board descriptor
v: Determines whether to handshake with receiver
Return valueThe value of the ibsta
Error CodesEADR, EARG, ECIC, EDVR, ENEB, EOIP
DescriptionSets 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
2-20Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
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 Table 2-10.
To determine whether a GPIB line is controlled:
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
ibln
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
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)
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
DescriptionDetermines if there is an available device on the 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
KI488-901-01 Rev. A / March 2010Return to Section Topics2-21
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
- 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 to the device if
ud is a device descriptor. If a listener is detected, a nonzero 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:No secondary addressing; primary addressing only
ALL_SAD: Tests all secondary addresses
found_listener: Shows if there is a device available
Return valueThe value of the ibsta
Error CodesEARG, ECIC, EDVR, ENEB, EOIP
ibloc
DescriptionIf a board is not in lockout status, the ibloc command 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, the ibloc command 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
SyntaxMicrosoft C/C++ and Borland C++
int ibloc (int ud)
Visual Basic
ibloc (ByVal ud As Integer) As Integer
- or -
call ibloc (ByVal ud As Integer)
Parametersud: Board or device descriptor
Return valueThe value of the ibsta
Error CodesEBUS, ECIC, EDVR, ENEB, EOIP
2-22Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
ibonl
DescriptionResets 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 has no effect. Once called, use the ibdev or ibfind commands to
access the board or device.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
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)
Parametersud: Board or device descriptor
onl: Online (1) or offline (0)
Return valueThe value of the ibsta
Error CodesEARG, ENEB
ibnotify
DescriptionUses the selected callback function to notify you of one or more GPIB events. The
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
Parametersud: Board or device descriptor
resynchronization 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.
int ibnotify (int ud, int mask,
GpibNotifyCallback_t Callback, void *RefData)
If GPIB mask is a non-zero value, the events specified by mask are
monitored by ibnotify; if one or more of the events appears, the
callback function is called. For board-level 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 during the time limit. If TIMO is not
KI488-901-01 Rev. A / March 2010Return to Section Topics2-23
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
set in the notify mask, the callback function is not called until one or
more specified events occur.
Table 2-11: GPIB event codes for mask
Event
codeDescription
- 0No mask
- 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)
ibpad
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
ibsta: The ibsta value
Local
LocalIberr: The iberr value
LocalIbcntl: The ibcntl value
RefData: The user-defined reference data for the
callback function
Return valueThe next mask of the notified GPIB event
Error codeEDVR
RefData: The user-defined reference data for the callback function
Return valueThe value of the ibsta
Error CodesEARG, ECAP, EDVR, ENEB, EOIP
.
DescriptionSets a board or device primary GPIB address.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibpad (int ud, int v)
2-24Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Visual Basic
ibpad (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibpad (ByVal ud As Integer, ByVal v As Integer)
Parametersud: Board or device descriptor
v: The GPIB primary address (the valid range is 0 to 30)
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
ibsad
DescriptionSets or disables a board or device secondary GPIB address.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibsad (int ud, int v)
ibpct
Visual Basic
ibsad (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibsad (ByVal ud As Integer, ByVal v As Integer)
Parametersud: Board or device descriptor
v: Set or disable the GPIB secondary address
If v = 0:The secondary address is disabled
If v is not = 0:The secondary address is enabled with a secondary
address valid range of 96 to 126 (0x60 to 0x7E)
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
DescriptionPasses controller-in-charge (CIC) status to another GPIB device that has
controller capability. The interface automatically releases the ATN line and goes to
controller idle status (CIDS).
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibpct (int ud)
Visual Basic
ibpct (ByVal ud As Integer) As Integer
KI488-901-01 Rev. A / March 2010Return to Section Topics2-25
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
- or -
call ibpct (ByVal ud As Integer)
Parametersud: Device descriptor
Return valueThe value of the ibsta
Error CodesEARG, EBUS, ECIC, EDVR, ENEB, EOIP
ibppc
DescriptionConfigures parallel polling.
If ud is a device descriptor: The ibppc command 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: The ibppc command 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 are no errors within the calling period, iberr maintains the previous
value of the local parallel poll configuration.
ibrd
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)
Parametersud: Device descriptor
v: Enable/disable parallel polling
Return valueThe value of the ibsta
Error CodesEARG, EBUS, ECAP, ECIC, EDVR, ENEB, EOIP
DescriptionReads 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
2-26Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
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
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 read from the GPIB
cnt: The number of the bytes read from the GPIB
ibrda
Return valueThe value of the ibsta
Error CodesEABO, EADR, EBUS, ECIC, EDVR, ENEB, EOIP
DescriptionAsynchronously 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 or END are 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 ibrda and
placed in the user buffer. 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 asynchronous I/O commands (ibcmda, ibrda, ibwrta) are designed so
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
KI488-901-01 Rev. A / March 2010Return to Section Topics2-27
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
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 resynchronized.
Use one of the following functions to resynchronize:
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 resynchronized.
ibstop: The I/O is stopped, and the driver and application are
resynchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and
application are resynchronized.
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 read from the GPIB
cnt: The number of the bytes read from the GPIB
Return valueThe value of the ibsta
Error CodesEABO, EADR, EBUS, ECIC, EDVR, ENEB, EOIP
DescriptionReads 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
SyntaxMicrosoft C/C++ and Borland C++
2-28Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
int ibrdf (int ud, const char *filename)
Visual Basic
ibrdf (ByVal ud As Integer, ByVal filename As
String ) As Integer
- or -
call ibrdf (ByVal ud As Integer, ByVal filename
As String)
Parametersud: Device descriptor
filename: The file name; the file stores the read data
Return valueThe value of the ibsta
Error CodesEABO, EADR, EBUS, ECIC, EDVR, EFSO, ENEB, EOIP
ibrpp
DescriptionPerforms parallel polling.
ibrsc
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibrpp (int ud, char *ppr)
Visual Basic
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
DescriptionSends the interface clear (IFC) 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
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
KI488-901-01 Rev. A / March 2010Return to Section Topics2-29
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
- 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
DescriptionPerforms 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.
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibrsp (int ud, char *spr)
Visual Basic
ibrsv
ibrsp (ByVal ud As Integer, spr As Integer)
As Integer
- or -
call ibrsp (ByVal ud As Integer, spr As Integer)
Parametersud: Device descriptor
spr: The sequential polling result
Return valueThe value of the ibsta
Error CodesEABO, EARG, EBUS, ECIC, EDVR, ENEB, EOIP, ESTB
DescriptionRequests service and changes the status byte of the sequential polling.
Support Level Board level
SyntaxMicrosoft C/C++ and Borland C++
ibrsv (int ud, int v)
Visual Basic
ibrsv (ByVal ud As Integer, ByVal v As Integer)
As Integer
- or -
call ibrsv (ByVal ud As Integer, ByVal v As Integer)
Parametersud: Device descriptor
v: The status byte of the sequential polling
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
2-30Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
ibsic
DescriptionEnables theGPIB interface clear (IFC) line to allow at least 100 ns 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 -
call ibsic (ByVal ud As Integer)
Parametersud: Device descriptor
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP, ESAC
ibsre
DescriptionSets or clears theremote enable (REN) line. The remote enable (REN) lineis
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
ibstop
DescriptionStops 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++
KI488-901-01 Rev. A / March 2010Return to Section Topics2-31
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
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
DescriptionSets 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. Valid timeout values are shown in Table 2-13.
Table 2-13: ibtmo timeout values
Constantv valueMinimum timeout
TNONE0Disabled - no timeout period
T10 μs110 μs
T30 μs230 μs
T100 μs3100 μs
T300 μs4300 μs
T1 ms51 ms
T3 ms63 ms
T10 ms710 ms
T30 ms830 ms
T100 ms9100 ms
T300 ms10300 ms
T1 s111 s
T3 s123 s
T10 s1310 s
T30 s1430 s
T100 s15100 s
T300 s16300 s
2-32Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Table 2-13: (continued) ibtmo timeout values
Constantv valueMinimum timeout
T1000 s171000 s
Return valueThe value of the ibsta
Error CodesEARG, EDVR, ENEB, EOIP
ibtrg
DescriptionThis command sends the group execute trigger (GET) message to a device.
Support Level Device level
SyntaxMicrosoft C/C++ and Borland C++
int ibtrg (int ud)
Visual Basic
ibtrg (ByVal ud As Integer) As Integer
- or -
ibwait
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)
SyntaxVisual Basic
ibwait (ByVal ud As Integer, ByVal mask As Integer)
As Integer
- or -
call ibwait (ByVal ud As Integer, ByVal mask As
Integer)
KI488-901-01 Rev. A / March 2010Return to Section Topics2-33
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Parametersud: Board or device descriptor
mask: GPIB events that can be monitored. 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
ibwrt
Return valueThe value of the ibsta
Error CodesEARG, EBUS, ECIC, EDVR, ENEB, ESRQ
DescriptionWrites 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.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibwrt (int ud, const void *buf, long cnt)
Visual Basic
ibwrt (ByVal ud As Integer, ByVal buf As String,
ByVal cnt As Long) As Integer
2-34Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
- or -
call ibwrt (ByVal ud As Integer, ByVal buf As
String)
Parametersud: Device unit descriptor
buf: The buffer that contains the sent data bytes
cnt: The number of sent data bytes
Return valueThe value of the ibsta
Error CodesEADR, EABO, EBUS, ECIC, EDVR, EOIP, ENEB, ENOL
ibwrta
DescriptionAsynchronously 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 asynchronous I/O commands (ibcmda, ibrda, ibwrta) are designed so
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 in progress are not
allowed. If the I/O has completed, the application and the driver must be
resynchronized.
Use one of the following functions to resynchronize:
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 resynchronized.
ibstop: The I/O is stopped, and the driver and application are
resynchronized.
ibonl: The I/O is stopped and the interface is reset; the driver and
application are resynchronized.
Support Level Board / device level
SyntaxMicrosoft C/C++ and Borland C++
int ibwrta (int ud, const void *buf, long cnt)
KI488-901-01 Rev. A / March 2010Return to Section Topics2-35
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
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)
Parametersud: Device unit descriptor
buf: The buffer that contains the sent data bytes
cnt:The number of sent data bytes
Return valueThe value of the ibsta
Error CodesEADR, EABO, EBUS, ECIC, EDVR, EOIP, ENEB, ENOL
ibwrtf
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 are 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
2-36Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
Multi-device functions
This section contains an NI command-compatible multi-device IEEE-488 function reference. Refer
to Section 1 for information about Keithley Command-Compatible Functions.
AllSpoll
DescriptionSequentiallypolls one or more devices. The responses and number of responses
of the poll are individually stored in resultList and ibcntl.
SyntaxMicrosoft C/C++ and Borland C++
void AllSpoll (int board_desc,
const Addr4882_t addressList[], short resultList[])
Visual Basic
call AllSpoll (ByVal board_desc As Integer,
addressList ( ) As Integer,
resultList ( ) As Integer)
Parametersboard_desc:Board ID
addressList:The list of the device addresses ended by NOADDR
DescriptionSends the interface clear (IFC) command to reset GPIB. The SendIFC command,
which is a part of GPIB initialization, forces the interface to controller-in-charge of
GPIB. The function also ensures that the connected devices are not addressed
and the interface calls of the devices are in idle status.
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: Board ID
Error CodesENEB, ESAC, EDVR, EOIP
SendLLO
DescriptionSends thelocal lockout (LLO) message to all devices. When the LLO is in effect,
SyntaxMicrosoft C/C++ and Borland C++
Parametersboard_desc: Board ID
void SendIFC (int board_desc)
Visual Basic
call SendIFC (ByVal ud As Integer)
only the controller-in-charge can change device states by sending appropriate
GPIB messages. SendLLO is reserved for use in uncommon local and remote
situations. Under normal conditions, SetRWLS is used to place a device in remote
operation with lockout.
void SendLLO (int board_desc)
Visual Basic
call SendLLO (ByVal ud As Integer)
Error CodesEBUS, ECIC, ENEB, ESAC, EDVR, EOIP
SendSetup
DescriptionConfigures the device to receive data by setting the devices listed in
addressList as listeners and setting the interface talk-active. After the
SendSetup call, SendDataBytes sends data from the interface to the devices.
2-46Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
When multiple SendDataBytes calls are used for transferring data, the address
setting capability of SendSetup is especially useful because each device does
not need to be addressed while each data block is transferred.
DescriptionConfigures 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, you cannot locally operate these devices.
call SetRWLS (ByVal ud As Integer,
addressList ( ) As Integer)
addressList: The list of the device addresses ended by NOADDR
controlled, the result contains a non-zero value. If it is not controlled, the result
contains a zero value. The TestSRQ command gets the current status of GPIB
SRQ line. The WaitSRQ command waits 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)
Parametersboard_desc: Board ID
result:The status of the SRQ line
KI488-901-01 Rev. A / March 2010Return to Section Topics2-47
Section 2: NI Command-Compatible FunctionsModels KPCI-488LPA and KUSB-488B Reference Manual
Error CodesEDVR, EOIP, ENEB
T estSys
DescriptionCauses devices to process self tests by sending the TST? message to the
devices, which makes the devices test themselves individually. It then reads 16-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 (for example, the ERR bit is not set in ibsta),
the failure number of the self tests is contained in ibcntl.
Alternatively, 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.
SyntaxMicrosoft C/C++ and Borland C++
void TestSys (int board_desc, Addr4882_t *addrlist,
short resultList[])
Visual Basic
T rigger
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
DescriptionSendsthe 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++
void Trigger (int board_desc, Addr4882_t address)
Visual Basic
call Trigger (ByVal ud As Integer,
ByVal address As Integer)
Parametersboard_desc: Board ID
address: The device address; the device to be triggered
Error CodesEARG, EBUS, EDVR, ECIC, EOIP, ENEB
2-48Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualSection 2: NI Command-Compatible Functions
T riggerList
DescriptionSends the group execute trigger (GET) GPIB message to multiple 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.
call TriggerList (ByVal ud As Integer,
addressList ( ) As Integer)
Parametersboard_desc: Board ID
addressList: The list of the device addresses ended by NOADDR
Error CodesEARG, EBUS, EDVR, ECIC, EOIP, ENEB
WaitSRQ
DescriptionWaits until the device controls the GPIB SRQ line. When WaitSRQ returns, the
result contains a non-zero value if the SRQ line is controlled. If it is not controlled,
the result contains a zero value. Get the current status of the GPIB SRQ line by
using the TestSRQ command. 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
KI488-901-01 Rev. A / March 2010Return to Section Topics2-49
In this appendix:
TopicPage
NI command-compatible status codes...............................................A-2
NI command-compatible function error codes ..................................A-3
Appendix A
Status/Error Codes
Appendix A: Status/Error CodesModels KPCI-488LPA and KUSB-488B Reference Manual
NI command-compatible status codes
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 16-bit word. A
bit value equal to one (1) means the condition occurred; a bit value equal to zero (0) means the
condition did not occur.
Table A-1: NI command-compatible status codes
Mnemonic Position Hex TypeDescription
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.
A-2Return to Section TopicsKI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference ManualAppendix A: Status/Error Codes
NI command-compatible function error codes
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.
Table A-2: NI command-compatible function error codes
Error
mnemoniciberr 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
KI488-901-01 Rev. A / March 2010Return to Section TopicsA-3
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