The basic steps for code generation are:
Create a model or open an existing model.
Configure the model for code generation by selecting the solver.
Configure PLC Coder code generation options.
The PLC Coder configuration parameters provide several options for the code generation.
|Simulink PLC Coder||Generate structured text and ladder diagram code from Simulink models, Stateflow charts, and MATLAB functions|
Get started with structured text code generation from a simple Simulink® model.
Call the generated function block with different values of the
ssMethodType argument for subsystem initialization and
Override the default naming convention, that uses the model name for the generated Structured Text code file.
Map model objects in your Simulink subsystem to constructs in generated structured text code.
Find the location of files for manually importing the generated structured text code to your IDE.
Configure model to generate structured text code for
Simulink.Parameter objects within the model Simulink data dictionary
Autogenerate structured text code for enum to integer conversion model.
Generate structured text code for different components of your model.
This example shows how to autogenerate structured text code for subsystem reference blocks.
Learn how global tunable parameters appear in code generated for the PC WORX™ IDE.
View block descriptions from your model as comments in generated Structured Text code.
Generate structured text code from a reusable subsystem and identify the code reuse.
Generate structured text code from a triggered subsystem and identify the trigger event-based execution in the generated code.
Generate structured text code from a multirate model and identify the multiple execution rates in the generated code.
Generate structured text code from a masked subsystem and identify the mask parameters in the generated code.
Generate structured text code from a Stateflow® Chart and identify event-based transitions or absolute time temporal logic in the generated code.
Workflow for generating structured text code with logging instrumentation.
Generate structured text code from a MATLAB Function block and identify the MATLAB® function content in the generated code.