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
Loading...
+ 51 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.