xPC Target    

Adding I/O Blocks with the Simulink Library Browser

xPC Target includes a Simulink block library for I/O drivers. The highest hierarchical level in the library is grouped by I/O function. The second level is grouped by board manufacturer. The manufacturer groups within this second level contain the driver blocks for specific boards.

This procedure uses the Simulink model xpc_osc.mdl as an example of how to add and connect I/O blocks.

  1. In the MATLAB window, type
  1. The Simulink block diagram opens for the model xpc_osc.mdl.

  1. In the Simulink window, from the View menu, click Show Library Browser.
  1. The Simulink Library Browser window opens. Alternatively, 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.

    Alternatively, you can access driver blocks using the xPC Target I/O driver library. See Adding I/O Blocks with the xPC Target Library.

  1. Double-click xPC Target.
  1. 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.
  1. 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.
  1. 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.
  1. The model xpcosc should look like the figure shown below.

    Note You cannot run this model unless you have the I/O board shown above installed in your target PC. However, you can substitute the driver blocks for another I/O board that is installed in the target PC.

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