Defining fixed-point variables

The elements required for defining fixed-point variables are included in a profile called FixedPoint.

About this task

This profile contains:

The word-size is determined by the type chosen, while the shift to use is determined by the value entered for the tag FXP_Shift.

The profile uses a file called FixedPoint.h, which contains:

The file is "included" into the generated code where fixed-point variables are generated.

Procedure

  1. Add the FixedPoint profile to your project as a reference.
    Note: The FixedPoint profile is added with IBM® Rational® Rhapsody® only if you selected the Automotive add-on during installation.
  2. In the browser, right-click the element that will contain the fixed-point variables and select Add New > General Elements > FixedPointVar.
  3. Name the new variable.
  4. Open the Features window for the new variable, and for Type select one of the fixed-point variable types (FXP_8Bit_T, FXP_16Bit_T, or FXP_32Bit_T). (If you do not see these types in the list, click Select and locate the relevant type in the tree that is displayed.)
  5. Set the shift to use by providing a value for the tag FXP_Shift (default value is 4). (The variable that was created already has the Fixed-Point stereotype applied to it.)

Feedback