gpib
(To be removed) Create GPIB object
gpib
will be removed in a future release. Use visadev
instead. For more information on updating your code, see
Compatibility Considerations.
Syntax
obj = gpib('
vendor
',boardindex,primaryaddress)
obj = gpib('vendor
',boardindex,primaryaddress,'PropertyName
',PropertyValue)
Arguments
| The vendor name. |
| The GPIB board index. |
| The instrument primary address. |
| A GPIB property name. |
| A property value supported by
|
| The GPIB object. |
Description
obj = gpib('
creates the GPIB object vendor
',boardindex,primaryaddress)obj
associated with the board specified
by boardindex
, and the instrument specified by
primaryaddress
. The GPIB hardware is supplied by
vendor
. Supported vendors are given below.
Vendor | Description |
---|---|
| Keysight® (formerly Agilent Technologies®) hardware |
| ICS Electronics™ hardware |
| Measurement Computing™ hardware |
| National Instruments™ hardware |
adlink | ADLINK Technology hardware |
obj = gpib('
creates the GPIB object with the specified property names and property values. If an
invalid property name or property value is specified, an error is returned and
vendor
',boardindex,primaryaddress,'PropertyName
',PropertyValue)obj
is not created.
Examples
This example creates the GPIB object g1
associated with a
National Instruments board at index 0 with primary address 1, and then connects
g1
to the instrument.
g1 = gpib('ni',0,1); fopen(g1)
The Type
, Name
,
BoardIndex
, and PrimaryAddress
properties are automatically configured.
g1.Type ans = gpib
g1.Name ans = GPIB0-1
g1.BoardIndex ans = 0
g1.PrimaryAddress ans = 1
To specify the secondary address during object creation,
g2 = gpib('ni',0,1,'SecondaryAddress',96);
Tips
At any time, you can use the instrhelp
function to view a
complete listing of properties and functions associated with GPIB objects.
instrhelp gpib
When you create a GPIB object, these property value are automatically configured:
Type
is given bygpib
.Name
is given by concatenatingGPIB
with the board index and the primary address specified in thegpib
function. If the secondary address is specified, then this value is also used inName
.BoardIndex
andPrimaryAddress
are given by the values supplied to thegpib
function.
Note
You do not use the GPIB board primary address in the GPIB object constructor syntax. You use the board index, and the instrument address.
You can specify the property names and property values using any format supported
by the set
function. For example, you
can use property name/property value cell array pairs. Additionally, you can specify
property names without regard to case, and you can make use of property name
completion. For example, these commands are all valid:
g = gpib('ni',0,1,'SecondaryAddress',96); g = gpib('ni',0,1,'secondaryaddress',96); g = gpib('ni',0,1,'SECOND',96);
Before you can communicate with the instrument, it must be connected to
obj
with the fopen
function. A connected
GPIB object has a Status
property value of
open
. An error is returned if you attempt to perform a read
or write operation while obj
is not connected to the
instrument.
You cannot connect multiple GPIB objects to the same instrument. A GPIB instrument is uniquely identified by its board index, primary address, and secondary address.
Note
To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB® command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.
Version History
Introduced before R2006aSee Also
visadev
| fopen
| instrhwinfo
| BoardIndex
| Name
| PrimaryAddress
| SecondaryAddress
| Status
| Type