xPC Target    

Defining I/O Block Parameters

The I/O block parameters define values for your physical I/O boards. For example, I/O block parameters include channel numbers for multichannel boards, input and output voltage ranges, and sample time.

This procedure uses the Simulink model xpc_osc.mdl as an example, and assumes you have added an analog input and an analog output block to your model. To add an I/O block, see either Adding I/O Blocks with the xPC Target Library or Adding I/O Blocks with the Simulink Library Browser.

  1. In the Simulink window, double-click the input block labeled Analog Input.
  1. The dialog box for the A/D converter opens.

  1. Fill in the dialog box. For example, for a single channel enter 1 in the Number of Channels box, select ±10 V for the input range, and select single-ended (16 channels) for the MUX switch position. Enter the same sample time you entered for the step size in the Simulation Parameters dialog box. Enter the base address for this ISA-bus board.
  1. The Block Parameters dialog box should look similar to the figure shown below.

  1. In the Simulink window, double-click the output block labeled Analog Output.
  1. The dialog box for the D/A converter opens.

  1. Fill in the dialog box. For example, for one channel enter [1] in the Channel Vector box; for an output level of ±10 V enter the code [-10] in the Range Vector box. Enter the same sample time you entered for the step size in the Simulation Parameters dialog box. Enter the base address for this ISA-bus board.
  1. The Block Parameters dialog box should look similar to the figure shown below.

If you change the sample time by changing the target object property SampleTime, the sample times you entered in both of the I/O blocks are set to the new value. The step size you entered in the Simulation Parameters dialog box remains unchanged.

Your next task is to build and run the target application. See xPC Target Application.


  Adding I/O Blocks with the Simulink Library Browser Polling Mode