Code Interface Configuration and Integration
The code that you generate from a model contains functions and variables that corresponds to the systems, signals, and block parameters in the model diagram. Control the appearance of these functions and variables by controlling variable characteristics such as:
Inlining the variables in the generated code.
Marking a variable definition to be local to a function block, global variable, or undefined variable.
Simplify software distribution and reduce the time and resources required to develop control algorithms by designing models from which you can generate reusable code.
You can integrate external code into the generated structured text code by using code configuration parameters to omit the definitions of certain identifiers from the generated code and using your own definitions.
- Control Appearance of Block Parameters in Generated Code
Specify storage class of block parameter to control whether the parameter appears as a local or global variable in generated structured text code.
- Block Parameters in Generated Code
Learn how block parameters are displayed in generated structured text code, such as constants, local variables, or global variables.
- Generate Structured Text Code For Simulink Data Dictionary Defined Model Parameters
Configure model to generate structured text code for
Simulink.Parameterobjects within the model Simulink data dictionary (SLDD).
- Structured Text Code Generation for Enum To Integer Conversion
Autogenerate structured text code for enum to integer conversion model.
- Structured Text Code Generation for Subsystem Reference Blocks
This example shows how to autogenerate structured text code for subsystem reference blocks.
- Global Tunable Parameter Initialization for PC WORX
Learn how global tunable parameters appear in code generated for the PC WORX™ IDE.
- Variable-Size Signal Code Generation
Generate PLC structured text code for variable-size data.
- Generate Global Variables from Signals in Model
Associate signals with a global data store so that they appear as global variables in generated Structured Text code.
External Code Integration
- Integrate User-Defined Function Blocks, Data Types, and Global Variables into Generated Structured Text
This example shows how to integrate user-defined function blocks, data types, and global variables into generated structured text.
- Integrate Custom Function Block in Generated Code
See how to omit a symbol definition from generated structured text code so that you can integrate your own definition.
- Integrate Externally Defined Identifiers
Omit definitions of certain identifiers from generated structured text code and use your own definitions.