Deploy Structured Text
Using Simulink PLC Coder, you can generate structured text and test bench code, and then import the generated code into the target IDE.
In this tutorial you learn how to:
plcdemo_simple_subsystemmodel and prepare the model for code generation.
Verify the code that you generated.
Automatically or manually import your generated code into your target IDE.
Simulink® PLC Coder™
Target IDE folder location (for automatic import).
plcdemo_simple_subsystemmodel. To open the model, enter:
Open the model settings and set Solver Selection to
Fixed-stepand Solver to
discrete(no continuous states).
If your target IDE is in the PLC IDEs for Importing Code Automatically , see Generate and Automatically Import Structured Text Code. Otherwise , see Importing Generated Structured Text Code Manually
Importing Generated Structured Text Code Manually
If your target IDE does not automatically import generated code:
Right-click the Subsystem block and select PLC Code > Options.
The Configuration Parameters dialog box is displayed.
On the PLC Code Generation pane, select an option from the Target IDE list, for example,
The default Target IDE list displays the full set of supported IDEs. To see a reduced subset of the target IDEs supported by Simulink PLC Coder, disable the option Show full target list. To customize this list, use the
Click Generate code.
Generates Structured Text code (same as the PLC Code > Generate Code for Subsystem option)
Stores generated code in
When code generation is complete, a View diagnostics hyperlink appears at the bottom of the model window. Click this hyperlink to open the Diagnostic Viewer window.
This window has links that you can click to open the associated files. For more information, see Files Generated by Simulink PLC Coder.
To import generated code into your target IDE import the generated files manually into your target IDE.