xPC Target    

xPC Target I/O Driver Structures

Properties for xPC Target I/O drivers are usually defined using the parameter dialog box associated with each Simulink block. However, for more advanced drivers, the available fields defined by text boxes, check boxes, and pull-down lists are inadequate to define the behavior of the driver. In such cases, a more textual description is needed to indicate what the driver has to do at run-time. Textual in this context refers to a programming language like syntax and style.

xPC Target currently uses a textual description contained in message structures for the RS-232, GPIB, CAN (initialization), and the general counter drivers (AMD9513).

What is a message structure? -- A message structure is a MATLAB array with each cell containing one complete message (command). A message consists of one or more statements.

Syntax of a message statement -- Each statement in a message has the following format:

The field names are defined by the driver, and need to be entered with the correct upper- and lowercase letters. However, you can choose your own structure name and enter that name into the driver parameter dialog box.

Creating a message structure -- You could enter the message structure directly in the edit field of the driver parameter dialog box. But because the message structure is an array and very large, this becomes cumbersome very easily.

A better way is to define the message structure as an array in an M-file and pass the structure array to the driver by referencing it by name. For example, to initialize an external A/D module and acquire a value during each sample interval, create an M-file with the following statements:

This approach is different from other xPC Target driver blocks:

During each sample interval, the driver block locates the structure defined in the Block Parameters dialog box, interprets the series of messages, and executes the command defined by each message.

Specific drivers and structures -- For detailed information on the fields in a message structure, see the following chapters in the xPC Target I/O Reference documentation:


  PCI Bus I/O Devices Updated Driver Information