xPC Target    

Adding I/O Blocks with the Simulink Library Browser

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

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 Simulink block diagram opens for the model xpcosc.mdl.

  1. In the Simulink window, and from the View menu, click Show Library Browser.

    The Simulink Library Browser window opens. Alternately, you can open the Simulink Library Browser by typing simulink in the MATLAB command window.

    You can access the xPC Target I/O library by right-clicking xPC Target, and then clicking Open the xPC Target Library.

  1. Double-click xPC Target.

    A list of I/O functions opens.

  1. Open a function group. For example, to open the A/D group for ComputerBoards, double-click A/D, and then double-click ComputerBoards.

    A list with the A/D driver blocks for ComputerBoards opens.

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


 Adding I/O Blocks with the xPC Target Library Defining I/O Block Parameters