Specifications

3 GPIB I/O Support
3-4
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:
GPIB Setup — One setup block is needed for each GPIB controller. The
setup block does not have any inputs or outputs, but sends the initialization
and termination messages.
GPIB Send/Receive — The send/receive block has inputs and outputs from
your Simulink model, and sequences both the send and receive messages.
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.