UsingSimulink® PLC Coder™ you can generate Structured Text, along with test bench code and import the generated code into the target IDE.
In this tutorial you will learn how to:
Open the plcdemo_ladder_timers
model and prepare the model for
code generation.
Verify the code you generated.
Have your generated code either automatically or manually imported into your target IDE.
Simulink PLC Coder
You have access to either Rockwell Automation® RSLogix™ 5000 or Studio 5000 IDE.
Open the plcdemo_ladder_timers
model.
Open the model settings and set Solver Selection to
Fixed-step
and Solver to
discrete(no continuous states)
.
You can manually import the generated L5X file into RSLogix 5000 or Studio 5000 IDEs.
For L5X import file generation:
Right-click the Motor Controller
block and select PLC Code > Options.
This displays the PLC Code Generation configuration parameters window:
On the PLC Code Generation pane, from the Target
IDE list, select either Rockwell Studio
5000:AOI
or Rockwell RSLogix5000:AOI
.
In Target IDE Path, enter the path to the folder where you want the generated L5X file to be saved. In, Code Output Directory, enter the name of the folder to save the generated L5X file.
Click Apply.
Right-click the Motor Controller
block and select
PLC CodeGenerate Code for Subsystem
.
Upon, completion of code generation the Diagnostic window displays a message with the path to the generated L5X file.