Stateflow User's Guide Previous page   Next Page

Overflow Detection for Fixed-Point Types

Overflow occurs when the magnitude of a result assigned to a data exceeds the numeric capacity of that data. You enable Stateflow to detect overflow of integer and fixed-point operations during simulation with the following steps:

  1. In the Stateflow diagram editor, from the Tools menu, select Open Simulation Target.
  1. The Stateflow Target Builder dialog opens with sfun entered in the Target Name field.

  1. Select Coder Options .
  1. The Stateflow sfun Coder Options dialog opens.

  1. Select both the Enable debugging/animation and Enable overflow detection (for debugging) options.
  1. For descriptions of these options, see Configuring a Simulation Target for Stateflow.

  1. Select OK to close the Stateflow sfun Coder Options dialog.
  2. In the Stateflow Target Builder dialog, select Build to build the simulation target.
  3. In the Stateflow diagram editor toolbar, select Debug to open the Debugging window.
  4. In the Debugging window, select Data Range.
  1. See Setting Error Checking in the Debugging Window for a description of this option.

  1. In the Debugging window, select Start to begin simulating the model.

Simulation breaks execution when an overflow occurs.


Previous page  Tips for Using Fixed-Point Data in Stateflow Sharing Fixed-Point Data with Simulink Next page

© 1994-2005 The MathWorks, Inc.