Embedded Target for Motorola MPC555 |
 |
Building PIL and Simulation Components
In this section, you will build a library of simulation, SIL, and PIL components from the fuel rate controller
subsystem:
- Right-click on the
fuel rate controller
subsystem. A context menu appears. Select Build Subsystem
from the Real-Time Workshop submenu of the context menu.
- The Build code for Subsystem window opens. This window displays information about each variable (or data object) that is referenced as a block parameter in the subsystem. The window lets you inline or set the storage class of individual parameters. We will not be concerned with these features in this exercise. Click the Build button to continue the code generation and build process.
- The build process displays status messages in the MATLAB command window. Intermediate Simulink windows are displayed as the build process creates various components.
- When the code generation process completes, the PIL target automates the process of compiling, downloading, and executing the generated PIL code that is to run on the target hardware. To accomplish this, the PIL target launches your cross-development system (Diab or CodeWarrior), compiles and makes the executable, and invokes the appropriate downloading and debugging utility (SingleStep or CodeWarrior debugger). You do not need to intervene in this process.
- At this point, the generated program is running on the target hardware and waiting for communication to be established with Simulink on the host PC.
- The build process has created and opened a library named
fuel_lib
, as shown in this figure.

The library contains
- A copy of the original
fuel rate controller
subsystem.
- A Real-Time Workshop Embedded Coder generated S-function, labeled
fuel rate controller (SIL)
.
- A subsystem block that communicates with generated PIL code running on the target board during cosimulation, labeled
fuel rate controller (PIL)
.
- A master Configurable Subsystem referencing the other three blocks. The default block choice for this subsystem is the original
fuel rate controller
subsystem.
The Configurable Subsystem, when plugged into the model, lets you choose which of the three library components will perform the controller functions in the model. We will use the Configurable Subsystem in the following sections.
The library window also contains the following controls:
- A Help button that displays PIL target documentation in the MATLAB help browser.
- A button that lets you replace the original (generating) subsystem in the model with the generated Configurable Subsystem.
- A button that lets you do the inverse, i.e., remove the Configurable Subsystem from the model from the original model and replace it with the original (generating) subsystem from the library.
The library window documents the name of the original model/subsystem from which the library was generated,
| Setting Up the Model | | Using the Demo Model In a PIL Cosimulation |  |