xPC Target    

Signal Tracing with MATLAB Commands

Creating a target scope object allows you to select and view signals using the xPC Target functions. This section describes how to signal trace using xPC Target functions instead of using the xPC Target graphical interface.

After you create and download, the target application, you can view output signals. This procedure uses the Simulink model xpcosc.mdl as an example, and assumes you have build the target application for that model.

  1. Start running your target application. Type either

    The target PC displays the following message.

  1. To get a list of parameters, type either

    The MATLAB window displays a list of the target objects properties for the available signals. For example, the signals for the model xpcosc.mdl are shown below.

    The signal names (S0, S1 . . .S6) are properties of the target object. And the Parameter identifiers (P0, P1, . . .P6) are properties of the target object.

  1. Create a scope to display on the target PC. For example, to create a scope with an identifier of 1 and an scope object name of sc1, type
  2. List the properties of the scope object. For example, to list the properties of the scope object sc1, type

    The MATLAB window displays a list of the scope object properties. Notice the scope properties StartTime, Time, and Data are not accessible with a scope of type target.

  1. Add signals to the scope object. For example, to add Integrator1 and Signal Generator, type

    The target PC displays the following messages.

    After you add signals to a scope object, the signals are not shown on the target screen until you start the scope.

  1. Start the scope object. For example, to start the scope sc1, type either

    The target screen plots the signals after collecting each data package. During this time you can observe the behavior of the signals while the scope is running.

  1. Stop the scope. Type either

    The signals shown on the target PC stop updating while the target application continues running, and the target PC displays the following message.


 Signal Tracing with xPC Target GUI (Target Manager) Parameter Tuning