Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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);

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.

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.

g.Name

ans =

GPIB0-1

g.Type

ans =

gpib

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.

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:

  • Type the GPIB object at the command line.

  • Exclude the semicolon when creating a GPIB object.

  • Exclude the semicolon when configuring properties using dot notation.

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

Related Topics

Was this topic helpful?