Products & Services Solutions Academia Support User Community Company

Learn more about Instrument Control Toolbox   

Creating a GPIB Object

Using the gpib Function

You create a GPIB object with the gpib function. gpib requires the adaptor name, the GPIB board index, and the primary address of the instrument. As described in Connecting to the Instrument, you can also configure property values during object creation. For a list of supported adaptors, refer to Interface Driver Adaptor.

Each GPIB object is associated with one controller and one instrument. For example, to create a GPIB object associated with a National Instruments controller with board index 0, and an instrument with primary address 1,

g = gpib('ni',0,1);

The GPIB object g now exists in the IEEE workspace. You can display the class of g with the whos command.

whos g
  Name      Size         Bytes  Class

  g         1x1            636  gpib object

Grand total is 14 elements using 636 bytes

Once the GPIB object is created, the following properties are automatically assigned values. These general-purpose properties describe the object based on its class type and address information.

GPIB Descriptive Properties

Property Name

Description

Name

Specify a descriptive name for the GPIB object.

Type

Indicate the object type.

You can display the values of these properties for g with the get function.

get(g,{'Name','Type'})
ans = 
    'GPIB0-1'    'gpib'

GPIB Object Display

The GPIB object provides you with a convenient display that summarizes important address and state information. You can invoke the display summary as follows:

You can also display summary information via the Workspace browser by right-clicking an instrument object and selecting Display Summary from the context menu.

The display summary for the GPIB object g is:

GPIB Object Using NI Adaptor : GPIB0-1

Communication Address 
   BoardIndex:         0
   PrimaryAddress:     1
   SecondaryAddress:   0

Communication State 
   Status:             closed
   RecordStatus:       off

Read/Write State  
   TransferStatus:     idle
   BytesAvailable:     0
   ValuesReceived:     0
   ValuesSent:         0
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS