Tektronix KPCI-488LPA, KUSB-488B Reference manual

www.keithley.com
A GREATER MEASURE OF CONFIDENCE

Model KPCI-488LPA GPIB Controller Interface Card and Model KUSB-488B USB to GPIB Converter

Reference Manual
KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B
Reference Manual
All rights reserved.
Cleveland, Ohio, U.S.A.
Any unauthorized reproduction, photocopy, or use the information herein, in whole or in part, without the
prior written approval of Keithley Instruments, Inc. is strictly prohibited.
All Keithley Instruments product names are trademarks or registered trademarks of Keithley Instruments, Inc.
Other brand names are trademarks or registered trademarks of their respective holders.
National Instruments
Document number:
and NI are trademarks of the National Instruments Corporation.
KI488-901-01 Rev. A / March 2010

Table of Contents

Section T opic Page
1 Keithley Command-Compatible Functions .................................... 1-1
Introduction ................................................................................................. 1-2
Using Keithley command-compatible functions.......................................... 1-2
Microsoft
Microsoft Visual C/C++......................................................................... 1-4
Microsoft Visual C# .............................................................................. 1-4
Keithley command-compatible function reference...................................... 1-2
GPIBBOARDPRESENT....................................................................... 1-5
BOARDSELECT .................................................................................. 1-5
ENTER ................................................................................................. 1-5
FEATURE............................................................................................. 1-6
INITIALIZE ........................................................................................... 1-6
LISTENERPRESENT........................................................................... 1-7
PPOLL.................................................................................................. 1-7
RARRAY............................................................................................... 1-7
RECEIVE ............................................................................................. 1-7
SEND ................................................................................................... 1-8
SETINPUTEOS.................................................................................... 1-8
SETOUTPUTEOS................................................................................ 1-8
SETTIMEOUT ...................................................................................... 1-9
SPOLL.................................................................................................. 1-9
SRQ ..................................................................................................... 1-9
TARR AY ............................................................................................... 1-9
TRANSMIT......................................................................................... 1-10
WAITSRQDEVICE ............................................................................. 1-12
2 NI Command-Compatible Functions........................................................... 2-1
Introduction ................................................................................................. 2-3
Using NI command-compatible functions ................................................... 2-3
Microsoft Visual Basic version 6.0 and .NET ....................................... 2-3
Microsoft Visual C/C++......................................................................... 2-5
Microsoft Visual C# .............................................................................. 2-5
Overview of NI command-compatible functions ......................................... 2-6
IEEE-488 device-level functions .......................................................... 2-6
IEEE-488 board-level functions............................................................ 2-7
IEEE-488.2 functions ........................................................................... 2-8
Data types ............................................................................................ 2-9
NI command-compatible function reference............................................... 2-9
ibask..................................................................................................... 2-9
ibbna .................................................................................................. 2-12
ibcac................................................................................................... 2-12
ibclr..................................................................................................... 2-13
ibcmd.................................................................................................. 2-13
ibcmda................................................................................................ 2-13
ibconfig............................................................................................... 2-14
ibdev................................................................................................... 2-16
ibdma ................................................................................................. 2-17
ibeot ................................................................................................... 2-18
ibeos................................................................................................... 2-18
ibfind................................................................................................... 2-19
ibgts.................................................................................................... 2-20
®
Visual Basic® version 6.0 and .NET ................................... 1-2
Table of Contents Models KPCI-488LPA and KUSB-488B Reference Manual
ibist..................................................................................................... 2-20
iblines ................................................................................................. 2-21
ibln...................................................................................................... 2-21
ibloc.................................................................................................... 2-22
ibonl.................................................................................................... 2-23
ibnotify................................................................................................ 2-23
ibpad .................................................................................................. 2-24
ibsad................................................................................................... 2-25
ibpct.................................................................................................... 2-25
ibppc................................................................................................... 2-26
ibrd ..................................................................................................... 2-26
ibrda ................................................................................................... 2-27
ibrdf .................................................................................................... 2-28
ibrpp ................................................................................................... 2-29
ibrsc.................................................................................................... 2-29
ibrsp ................................................................................................... 2-30
ibrsv.................................................................................................... 2-30
ibsic .................................................................................................... 2-31
ibsre ................................................................................................... 2-29
ibstop.................................................................................................. 2-31
ibtmo .................................................................................................. 2-32
ibtrg .................................................................................................... 2-33
ibwait .................................................................................................. 2-33
ibwrt.................................................................................................... 2-34
ibwrta.................................................................................................. 2-35
ibwrtf................................................................................................... 2-36
Multi-device functions ............................................................................... 2-37
AllSpoll ............................................................................................... 2-37
DevClear ............................................................................................ 2-37
DevClearList....................................................................................... 2-37
EnableLocal ....................................................................................... 2-38
EnableRemote ................................................................................... 2-38
FindLstn ............................................................................................. 2-38
FindRQS ............................................................................................
PassControl..
...................................................................................... 2-39
2-39
PPoll................................................................................................... 2-40
PPollConfig ........................................................................................ 2-40
PPollUnConfig.................................................................................... 2-41
RcvRespMsg...................................................................................... 2-41
ReadStatusByte ................................................................................. 2-42
Receive .............................................................................................. 2-42
ReceiveSetup..................................................................................... 2-43
ResetSys............................................................................................ 2-43
Send................................................................................................... 2-44
SendCmds ......................................................................................... 2-44
SendDataBytes .................................................................................. 2-45
SendList ............................................................................................. 2-45
SendIFC ............................................................................................. 2-46
SendLLO ............................................................................................ 2-46
SendSetup ......................................................................................... 2-46
SetRWLS ........................................................................................... 2-47
TestSRQ............................................................................................. 2-47
TestSys............................................................................................... 2-48
Trigger ................................................................................................ 2-48
TriggerList .......................................................................................... 2-49
WaitSRQ ............................................................................................ 2-49
ii KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Table of Contents
Appendix T opic Page
A Status/Error Codes ............................................................................... A-1
NI command-compatible status codes........................................................ A-2
NI command-compatible function error codes............................................ A-3
Index ............................................................... ............................................. Index-1
KI488-901-01 Rev. A / March 2010 iii
In this section:
Topic Page
Introduction..................................................................................... 1-2
Using Keithley command-compatible functions.......................... 1-2
Keithley command-compatible function reference...................... 1-5
Section 1
Keithley Command-Compatible Functions
Microsoft® Visual Basic® version 6.0 and .NET.......................... 1-2
Microsoft Visual C/C++............................................................... 1-4
Microsoft Visual C#..................................................................... 1-4
GPIBBOARDPRESENT ............................................................. 1-5
BOARDSELECT......................................................................... 1-5
ENTER ....................................................................................... 1-5
FEATURE................................................................................... 1-6
INITIALIZE .................................................................................. 1-6
LISTENERPRESENT ................................................................. 1-7
PPOLL ........................................................................................ 1-7
RARRAY..................................................................................... 1-7
RECEIVE.................................................................................... 1-7
SEND.......................................................................................... 1-8
SETINPUTEOS .......................................................................... 1-8
SETOUTPUTEOS ...................................................................... 1-8
SETTIMEOUT ............................................................................ 1-9
SPOLL ........................................................................................ 1-9
SRQ............................................................................................ 1-9
TARR AY...................................................................................... 1-9
TRANSMIT ................................................................................. 1-10
WAITSRQDEVICE...................................................................... 1-12
Section 1: Keithley Command-Compatible Functions Models 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.
NOTE Refer 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-2 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 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 2010 Return to Section Topics 1-3
Section 1: Keithley Command-Compatible Functions Models 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
NOTE The 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"
NOTE Keithley 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-4 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 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

Description Verifies whether a GPIB board is present in the GPIB system. Syntax Microsoft C/C++ and Borland C++
char gpib_board_present(void)
Visual Basic
GpibBoardPresent( ) As Long
Return value 0: GPIB board is not installed

BOARDSELECT

Description Designates which board is the active board. Syntax Microsoft C/C++ and Borland C++
Parameters board: The board number; valid values are 0 to 3

ENTER

Description Reads data from a specified device. Syntax Microsoft 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 2010 Return to Section Topics 1-5
Section 1: Keithley Command-Compatible Functions Models KPCI-488LPA and KUSB-488B Reference Manual
Parameters buf: 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

Description Returns the GPIB board settings or hardware features. Syntax Microsoft C/C++ and Borland C++
long int feature (long int f)
Visual Basic
GPIBFeature (ByVal f As Long) As Long
Parameters f: The feature or setting information desired. Valid FEATURE values are
contained in Table 1-1.
Table 1-1: FEATURE parameters
Feature (constants)
IEEEListener 0 Verifies that ListenerPresent function is supported by
IEEEIOBASE 100 The board’s I/O base address IEEETIMEOUT 200 The board’s I/O timeout setting IEEEINPUTEOS 201 The current input EOS character setting IEEEOUTPUTEOS1 202 The current output EOS character 1 setting IEEEOUTPUTEOS2 203 The current output EOS character 2 setting IEEEBOARDSELECT 204 The current active board number
Return value The value of the feature or setting

INITIALIZE

Description Opens and initializes a GPIB board. Syntax Microsoft 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)
Parameters addr : GPIB address assigned to the board
level: 0: Specifies the board as a system controller
1: Specifies the board as a device
1-6 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 1: Keithley Command-Compatible Functions

LISTENERPRESENT

Description Checks for a specified listener on the GPIB system. Syntax Microsoft C/C++ and Borland C++
char listener_present(long int addr)
Visual Basic
ListenerPresent (ByVal addr As Long) As Long
Parameters addr: The listener address to check Return value 0: The specified listener is not present
1: The specified listener is present

PPOLL

Description Performs a parallel poll and reads the status of devices. Syntax Microsoft C/C++ and Borland C++
int ppoll (char *poll)
Visual Basic
Parameters poll: Returned parallel polling status

RARRA Y

Description Receives a block of binary data (up to 64K) from a device defined as the talker.
Syntax Microsoft C/C++ and Borland C++
Parameters buf: The buffer storing the received binary data
Return value 0: 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

Description Reads data from a specified device, but does not address a talker. The GPIB
addressing must be performed using the TRANSMIT function.
Syntax Microsoft C/C++ and Borland C++
KI488-901-01 Rev. A / March 2010 Return to Section Topics 1-7
Section 1: Keithley Command-Compatible Functions Models 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)
Parameters buf: The buffer storing the received data
maxlen: Sets maximum bytes of data to receive
len: Returns the actual number of received data bytes
Return value 0: Read data successfully
8: Timeout error

SEND

Description Sends commands to a specified GPIB device. Syntax Microsoft C/C++ and Borland C++
long int send (long int addr, char *buf, unsigned long maxlen, long int *status)
Parameters addr: The listener address
Return value 0: Data sent successfully

SETINPUTEOS

Description Sets the terminating character for input data transfer. Syntax Microsoft C/C++ and Borland C++
Parameters eos_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

Description Sets the terminating characters for output data transfer. Syntax Microsoft C/C++ and Borland C++
void setoutputEOS (long int e1, long int e2)
1-8 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 1: Keithley Command-Compatible Functions
Visual Basic
call setoutputEOS (ByVal e1 As Long, ByVal e2 As Long)
Parameters e1: The first terminating character for output data transfer
e2: The second terminating character for output data transfer

SETTIMEOUT

Description Sets the maximum duration allowed for a read/write operation (timeout period). Syntax Microsoft C/C++ and Borland C++
void settimeout (unsigned long int timeout)
Visual Basic
call settimeout (ByVal timeout As Long)
Parameters timeout: The timeout value in milliseconds (ms)

SPOLL

Description Performs serial polling and reads the specified device’s status.
SRQ
Syntax Microsoft 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)
Parameters addr: The address of the device to poll
poll: Returns the result of serial polling
Return value 0: Data sent successfully
8: Timeout error
Description Checks for device service requests. Syntax Microsoft C/C++ and Borland C++
char srq(void)
Visual Basic
srq ( ) As Long
Return value 0: The device is not requesting service
1: The device is requesting service

T ARRAY

Description Sends a block of binary data from memory to the devices defined as listeners;
GPIB addressing must be performed using the TRANSMIT function.
Syntax Microsoft C/C++ and Borland C++
KI488-901-01 Rev. A / March 2010 Return to Section Topics 1-9
Section 1: Keithley Command-Compatible Functions Models 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)
Parameters buf: The buffer storing the data to send
count: The maximum number of data bytes to transmit
eoi: Enable or disable EOI device mode; 0 = disable EOI;
1 = enable EOI
Return value 0: Read data successfully
8: Timeout error 32: Data transfer terminated with EOI

TRANSMIT

Description Sends GPIB commands and data according to a series of GPIB commands and
data in a specified string.
Syntax Microsoft C/C++ and Borland C++
long int transmit (char * cmd, unsigned maxlen, long int * status);
Visual Basic
call transmit(cmd As String, status As Integer)
Parameters cmd: The buffer containing the command string and data to send; valid cmd
string values are contained in Table 1-2.
maxlen: The maximum number of command string bytes to send
Return value status:
0: Sent command and data successfully 1: Illegal command syntax 8: Timeout error 16: Unknown command 32: Data transfer terminated with EOI
1-10 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 1: Keithley Command-Compatible Functions
Table 1-2: TRANSMIT command string parameters
Commands Description Example
LISTEN
TALK
SEC
UNT UNL MTA
MLA
DATA
END
REN EOI
GTL SPE SPD PPC PPD PPU DCL LLO CMD
GET SDC TCT IFC
Sets the addresses of the listeners. The values following LISTEN are the GPIB addresses of the listeners.
Sets the address of the talker. The
values following
addresses of the talker. There is only one talker at a time. Sets the second address of the talker or listener. This command should follow
TALK are the GPIB
TALK or LISTEN.
Untalk. "UNT" Unlisten. "UNL" “My Talk Address,” assigns the active
GPIB board as the talker. “My Listen Address,” assigns the active GPIB board as the listener. Starts the data part. Before the DATA
command, the GPIB board must be set as the talker. Strings are enclosed by quotes(') and sent as characters.
Sends terminator characters. The DATA command should be called before this command. Remote Enable "REN"
End-or-Identify. The data bytes following
EOI are the last bytes to transmit. The
last byte is sent with the EOI signal. Go to local "GTL"
Serial poll enable "SPE" Serial poll disable "SPD" Parallel poll configure "PPC" Parallel poll disable "PPD" Parallel poll unconfigure "PPU" Device clear "DCL" Local lockout "LLO" Starts GPIB command. The values
followed by command messages and sent as binary values.
Group execute trigger "GET" Selected device clear "SDC" Take control "TCT" Interface clear "IFC"
CMD are treated as GPIB
"LISTEN 1 2 3" Meaning: Configure devices whose GPIB addresses are 1, 2, and 3, as listeners.
TALK 0"
" Meaning: Configure device whose GPIB address is 0, as talker.
"TALK 0 SEC 1" Meaning: Configure device with primary GPIB address of 0 and secondary address of 1, as talker.
"MTA"
"MLA"
"DATA 'hello' 13 10"
"DATA '*IDN?' END" Meaning: Send data message "*IDN?" and then send terminator bytes
"DATA '*IDN?' EOI 10" Meaning: Send data message "*IDN?" and then send line feed with EOI signal.
CMD 20"
" Meaning: Send GPIB command message, device clear (DCL).
KI488-901-01 Rev. A / March 2010 Return to Section Topics 1-11
Section 1: Keithley Command-Compatible Functions Models KPCI-488LPA and KUSB-488B Reference Manual

W AITSRQDEVICE

Description This function waits until a device is requesting service or a timeout error occurs. Syntax Microsoft C/C++ and Borland C++
long int waitSRQDevice (long int addr, char *poll, long int *status)
Parameters addr: The device address
poll: The returned poll status
status: Indicates whether or not a serial poll was performed
1-12 Return to Section Topics KI488-901-01 Rev. A / March 2010
In this section:
Topic Page
Introduction..................................................................................... 2-3
Using NI command-compatible functions .................................... 2-3
Overview of NI command-compatible functions.......................... 2-6
Section 2
NI Command-Compatible Functions
Microsoft Visual Basic version 6.0 and .NET.............................. 2-3
Microsoft Visual C/C++............................................................... 2-5
Microsoft Visual C#..................................................................... 2-5
IEEE-488 device-level functions................................................. 2-6
IEEE-488 board-level functions .................................................. 2-7
IEEE-488.2 functions.................................................................. 2-8
Data types................................................................................... 2-9
NI command-compatible function reference................................ 2-9
ibask ........................................................................................... 2-9
ibbna........................................................................................... 2-12
ibcac ........................................................................................... 2-12
ibclr ............................................................................................. 2-13
ibcmd .......................................................................................... 2-13
ibcmda ........................................................................................ 2-13
ibconfig ....................................................................................... 2-14
ibdev ........................................................................................... 2-16
ibdma.......................................................................................... 2-17
ibeot............................................................................................ 2-18
ibeos ........................................................................................... 2-18
ibfind ........................................................................................... 2-19
ibgts ............................................................................................ 2-20
ibist ............................................................................................. 2-20
iblines ......................................................................................... 2-21
ibln .............................................................................................. 2-21
ibloc ............................................................................................ 2-22
ibonl ............................................................................................ 2-23
ibnotify ........................................................................................ 2-23
ibpad........................................................................................... 2-24
ibsad ........................................................................................... 2-25
ibpct ............................................................................................ 2-25
ibppc ........................................................................................... 2-26
ibrd.............................................................................................. 2-26
ibrda............................................................................................ 2-27
ibrdf............................................................................................. 2-28
ibrpp............................................................................................ 2-29
ibrsc ............................................................................................ 2-29
Section 2: NI Command-Compatible Functions Models KPCI-488LPA and KUSB-488B Reference Manual
Topic (continued) Page
ibrsp ........................................................................................... 2-30
ibrsv ........................................................................................... 2-30
ibsic............................................................................................ 2-31
ibsre ........................................................................................... 2-31
ibstop ......................................................................................... 2-31
ibtmo .......................................................................................... 2-32
ibtrg ............................................................................................ 2-33
ibwait.......................................................................................... 2-33
ibwrt ........................................................................................... 2-34
ibwrta.......................................................................................... 2-35
ibwrtf........................................................................................... 2-36
Multi-device functions....................................................................... 2-37
AllSpoll ....................................................................................... 2-37
DevClear .................................................................................... 2-37
DevClearList .............................................................................. 2-37
EnableLocal ............................................................................... 2-38
EnableRemote ........................................................................... 2-38
FindLstn ..................................................................................... 2-38
FindRQS .................................................................................... 2-39
PassControl ............................................................................... 2-39
PPoll........................................................................................... 2-40
PPollConfig ................................................................................ 2-40
PPollUnConfig............................................................................ 2-41
RcvRespMsg.............................................................................. 2-41
ReadStatusByte ......................................................................... 2-42
Receive ...................................................................................... 2-42
ReceiveSetup............................................................................. 2-43
ResetSys.................................................................................... 2-43
Send........................................................................................... 2-44
SendCmds ................................................................................. 2-44
SendDataBytes .......................................................................... 2-45
SendList ..................................................................................... 2-45
SendIFC..................................................................................... 2-46
SendLLO.................................................................................... 2-46
SendSetup ................................................................................. 2-46
SetRWLS ................................................................................... 2-47
TTestSRQ .................................................................................. 2-47
TestSys ...................................................................................... 2-48
Trigger........................................................................................ 2-48
TriggerList .................................................................................. 2-49
WaitSRQ .................................................................................... 2-49
2-2 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 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.
NOTE Refer 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 2010 Return to Section Topics 2-3
Section 2: NI Command-Compatible Functions Models 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-4 Return to Section Topics KI488-901-01 Rev. A / March 2010
Models KPCI-488LPA and KUSB-488B Reference Manual Section 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
NOTE The 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"
NOTE NI 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 2010 Return to Section Topics 2-5
Section 2: NI Command-Compatible Functions Models 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:
IEEE-488 device-level functions
IEEE-488 board-level functions
IEEE-488.2 functions

IEEE-488 device-level functions

Table 2-1 contains IEEE-488 device-level functions.
Table 2-1: IEEE-488 device-level functions
Function Description
ibask ibbna ibclr
ibconfig ibdev ibeos ibeot
ibln ibloc ibonl ibpad ibpct
ibppc ibrd ibrda ibrdf ibrdi ibrdia ibrpp ibrsp ibsad ibstop
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
controller capability. Configures parallel polling.
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-6 Return to Section Topics KI488-901-01 Rev. A / March 2010
Loading...
+ 51 hidden pages