sf_fixpt (Simulink model) Open this Model

Fixed-Point Conversions

Stateflow allows you to include fixed-point data in your chart. This demonstration illustrates how you can input a value of type 'double' to a stateflow chart and output a fixed-point data type back to Simulink. The output data type is an 8 bit signed integer with a slope bias of 2^-5. This means that the maximum value of the output is 3.96875 and the minimum value is -4.

If you run the simulation, you will notice that chart output signal truncates the input signal at the above mentioned maximum and minimum values. The Stateflow chart is simply taking the input signal and changing the data type to fixed point. This allows you to use the Stateflow chart as a fixed-point data converter.