Products & Services Solutions Academia Support User Community Company

Learn more about xPC Target   

GPIB Drivers

Introduction

The xPC Target software interfaces the target PC to a GPIB instrument bus using an external GPIB controller from National Instruments. This external controller is connected to the target PC with a serial cable.

The xPC Target software uses a model for I/O that includes both Simulink blocks, for the I/O drivers, and MATLAB structures for sequencing messages and commands. This model provides increased flexibility and control over using only Simulink blocks in your model.

Hardware Connections for GPIB

The xPC Target software supports connecting to a GPIB instrument bus with a GPIB-232CT-A controller from National Instruments.

One end of the controller is connected to either the COM1 or COM2 port on the target PC with a null modem cable. The other end is connected to the GPIB instrument bus with a standard GPIB connector and cable.

Simulink Blocks for GPIB

To support the use of GPIB, the xPC Target I/O library includes a set of GPIB driver blocks. These driver blocks can be added to your Simulink model to provide inputs and outputs to devices on a GPIB instrument bus.

MATLAB Message Structures for GPIB

Communication is through a series of messages passed back and forth between the target PC and the GPIB controller. To accomplish this, the messages sent to the GPIB controller must be in a format that the controller understands. Likewise, the target PC must know how to interpret the data returned from the GPIB controller.

xPC Target uses MATLAB structures to create messages and map the input and output ports on the GPIB driver blocks to the data written and read from the GPIB devices. The GPIB Setup block executes the messages in the initialization structure after downloading the target application. The GPIB Send/Receive block repeats the execution of the messages in the send/receive structure during each sample interval. When the target application stops running, the GPIB Setup block executes the messages in the termination structure.

Below is an example of a send/receive message structure. The first message writes a command to instruct the GPIB device to acquire a single data value, while the second message sends a command to read that value and output the result to the output port line coming from a GPIB driver block.

Currently, only two limitations exist. The xPC Target software does not support string data types as input and output data types. Also, you must know the size and order of data returned from a read command.

For more information on this example, see Creating GPIB Message Structures.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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