xPC Target    

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. xPC Target 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


  Simulink Blocks for GPIB Using GPIB Drivers