Contents

Generating Structured Text for Simulink® Model with Fixed-Point Data Types

Open the subsystem at the top level named 'Subsystem'. Simulate the model and observe the fixed point types displayed on the signals.

You can generate PLC Structured Text code for this subsystem by right-clicking on the subsystem block and select PLC Code -> Generate Code for Subsystem Alternatively, you can use the following command generatedFiles = plcgeneratecode('plcdemo_fixed_point/Subsystem');

After the code generation, the Diagnostic Viewer window is displayed with hyperlinks to the generated code files. You can open the generated files by clicking on the links. You will notice that all the fixed-point input/outputs in the model as well as internal state variables have been lowered to integer data types.

Was this topic helpful?