Main Content

Deploy Ladder Diagram

Using Simulink® PLC Coder™ you can generate Structured Text, along with test bench code and import the generated code into the target IDE.

Learning Objectives

In this tutorial you will learn how to:

  • Open the plcdemo_ladder_timers model and prepare the model for code generation. To open the model, enter:

    openExample('plcdemo_ladder_timers');

  • Verify the code you generated.

  • Have your generated code either automatically or manually imported into your target IDE.

Prerequisites

  • Simulink PLC Coder

  • You have access to either Rockwell Automation® RSLogix™ 5000 or Studio 5000 IDE.

Workflow

  1. Open the plcdemo_ladder_timers model. To open the model, enter:

    openExample('plcdemo_ladder_timers');

  2. Open the model settings and set Solver Selection to Fixed-step and Solver to discrete(no continuous states).

  3. See Importing Generated Ladder Diagram Code Manually

You can manually import the generated L5X file into RSLogix 5000 or Studio 5000 IDEs.

Importing Generated Ladder Diagram Code Manually

For L5X import file generation:

  1. Right-click the Motor Controller block and select PLC Code > Options.

    This displays the PLC Code Generation configuration parameters window:

  2. On the PLC Code Generation pane, from the Target IDE list, select either Rockwell Studio 5000:AOI or Rockwell RSLogix5000:AOI.

  3. 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.

  4. Click Apply.

  5. Right-click the Motor Controller block and select PLC CodeGenerate Code for Subsystem .

  6. Upon, completion of code generation the Diagnostic window displays a message with the path to the generated L5X file.