xPC Target    

Control with Simulink External Mode

Control of your xPC Target application with Simulink is limited to connecting a Simulink model to a target application through external mode, and starting the target application. Using Simulink external mode is one method to tune parameters.

After you create and download a target application to the target PC, you can run the target application. This procedure uses the Simulink model xpc_osc2.mdl as an example. See Building and Downloading the Target Application.

  1. In the Simulink window, and from the Simulation menu, click External.
  1. A check mark appears next to the menu item External, and Simulink external mode is activated. Simulink external mode connects your Simulink model to your target application as a simple graphical user interface.

  1. In the Simulink block window, and from the Simulation menu, click Connect to target.
  1. All of the current Simulink model parameters are downloaded to your target application. This downloading guarantees the consistency of the parameters between the host model and the target application.

    The target PC displays the following message where # is the actual number of tunable parameters in your model:

  1. From the Simulation menu, click Start real-time code.
  1. The StopTime is changed to 99999999 seconds, the target application begins running, and the target PC displays the following message:

  1. In the MATLAB Command Window, type
  1. Note You cannot stop the target application from the Simulink window by clicking Stop real-time code from the Simulation menu.


  Control with MATLAB Commands Signals and Parameters