Embedded Target for Motorola HC12 Previous page   Next Page

The Example Model

This tutorial uses a simple demo model, hc12_led. This demo is provided with the Embedded Target for Motorola HC12.

hc12_led (see Figure 3-1) is a single-rate model that uses a Digital Output block to write to port B on the HC12. On the EVB912DP256, port B is wired to the LEDs, so writing to port B can illuminate the LEDs.

In the hc12_led model, one set of blocks is used to shift a bit left. The result of this operation is summed with the output of a similar set of blocks that shifts a separate bit right. These shift operations are phased so that only one LED is illuminated at any instant in time. As a result, the LEDs first show a bit shifting consecutively to the left (8 times). Then, a bit is seen shifting consecutively to the right (8 times).

This tutorial uses the model to provide a visual indication that the generated program has successfully downloaded and started in target RAM. We will not be concerned with the detailed operation of the model.

Begin by making a local copy of the model:

  1. Open the model. If you are reading this document online in the MATLAB Help browser, you can open the model by clicking on this link: hc12_led.

  1. Alternatively, type the model name at the MATLAB command line:

  1. Create a directory, hc12_tut, that is outside the MATLAB directory structure. Make hc12_tut your working directory.
  2. Save a local copy of the hc12_led model to your working directory. We work with this copy throughout this exercise.

Figure 3-1: hc12_led Model

  1. Notice the Master block in the upper left corner of the model. One (and only one) Master block is required in every model used for code generation with the Embedded Target for Motorola HC12. Unlike conventional blocks, the Master block is not connected to other blocks via signal lines. The Master block provides the following core functionality for the model:

To learn how to configure the model and generate a program for your target board, continue to Tutorial: Creating an Application with the Embedded Target for Motorola HC12.


Previous page  Introduction Tutorial: Creating an Application with the Embedded Target for Motorola HC12 Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2010 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS