xPC Target    

Adding I/O Blocks with the xPC Target Library

xPC Target contains an I/O driver library with Simulink blocks. You can drag-and-drop these blocks from the library to your Simulink model. Alternately, you can access the I/O driver library with the Simulink Library Browser. See Adding I/O Blocks with the Simulink Library Browser.

The highest hierarchy level in the library is grouped by I/O function. I/O functions include A/D, D/A, Digital In, Digital Out, Counter, Watchdog, Incremental Encoder, RS232, CAN, GPIB, and shared memory. The second level is grouped by board manufacturer. The manufacturer groups within this second level contain the specific boards.

This procedure uses the Simulink model xpcosc.mdl as an example of how to connect an I/O block.

  1. In the MATLAB window, type

    The Library: xpclib window opens.

  1. Open a function group. For example, to open the A/D group, double-click the A/D block.

    The manufacturer level opens.

    Within each manufacturer group are the blocks for a single function.

  1. Open a manufacturer group. For example, to open the A/D driver blocks from ComputerBoards, double-click the group marked ComputerBoards.

    The window with the A/D driver blocks for ComputerBoards opens.

  1. In the Simulink window, type

    The Simulink block diagram opens for the model xpcosc.mdl.

  1. From the block library, click-and-drag the name of an A/D board to the Simulink block diagram. Likewise, click-and-drag the name of a D/A board to your model.

    Simulink adds the new I/O blocks to your model.

  1. Remove the signal generator block and add the analog input block in its place. Remove the scope block and add the analog output block in its place.

    The demo model xpcosc should look like the figure shown below.

Your next task is to define the I/O block parameters. See Defining I/O Block Parameters.


 xPC Target I/O Driver Blocks Adding I/O Blocks with the Simulink Library Browser