Main Content

Ladder Diagram Integration

R2026b
Import, simulate, and validate your existing ladder diagrams. Model, simulate, and generate code using the provided Ladder Diagram blocks and functions

Ladder Diagram is a graphical programming language that you use to develop software for programmable logic controllers (PLCs). It is one of the languages that the IEC 61131 standard specifies for use with PLCs. A program in ladder diagram notation is a circuit diagram that emulates circuits of relay logic hardware. The underlying program uses Boolean expressions that translate readily to switches and relays.

With Simulink® PLC Coder™, you can use ladder import to import ladder diagrams created with Rockwell Automation® IDEs, such as RSLogix™ 5000 and Studio 5000 into the Simulink environment as a model. You can create ladder diagrams in the Simulink environment as a model.

After importing or creating the ladder diagram models, you can:

  • Edit the imported Ladder Diagram model from within Simulink by using the plcladderlib library.

  • After importing the ladder diagram code into Simulink, simulate it.

  • Generate C code from the imported ladder diagram and integrate the code into your existing C language-based simulation environments.

  • Generate ladder diagram code from the imported ladder diagram and integrate the code into your Rockwell Automation IDE. You cannot generate structured text code from the Ladder Diagram blocks.

  • Generate PLC testbench code for the imported ladder diagram and verify the code in your Rockwell Automation IDE.

Apps

Simulink PLC CoderGenerate structured text and ladder diagram code from Simulink models, Stateflow charts, and MATLAB functions

Functions

expand all

plcimportladderImport ladder diagram into a Simulink subsystem
plcgeneratecodeGenerate structured text or ladder diagram (L5X) for the atomic subsystem
plcladderinstructionsLists ladder instructions identified by Simulink PLC Coder
plcladderlibOpen the Simulink PLC Coder Ladder Library
plcgeneraterunnertbGenerate L5X test bench code for specified AOI Runner block and AOI name
plcladderoptionGet or set parameter values for ladder diagram model
plcloadtypesLoad the data types for Simulink PLC Coder ladder models
plccleartypesClear the data types associated with the Simulink PLC Coder ladder models from the workspace

Blocks

expand all

ONS blockONSOne Shot
OSR blockOSROne Shot Rising
OSF blockOSFOne Shot Falling
XIC blockXICExamine If Closed
XIO blockXIOExamine If Open
OTE blockOTEOutput Energize
OTL blockOTLOutput Latch
OTU blockOTUOutput Unlatch
TON blockTONTimer On Delay
TOF blockTOFTimer Off Delay
RTO blockRTORetentive Timer On
CTU blockCTUCount Up
CTD blockCTDCount Down
RES blockRESReset
JMP blockJMPJump
LBL blockLBLLabel
TND blockTNDTemporary End
AFI blockAFIAlways False
NOP blockNOPNo Operation
MCR blockMCRMaster Control Reset
ADD blockADDAdd inputs
SUB blockSUBSubtract inputs
MUL blockMULMultiply inputs
DIV blockDIVDivide one input by another
CPT blockCPTEvaluate expression
AND blockANDBitwise AND
OR blockORBitwise OR
NOT blockNOTBitwise NOT
NEQ blockNEQNot Equal To
EQU blockEQUEqual To
LEQ blockLEQLess Than or Equal To
GEQ blockGEQGreater Than or Equal To
LES blockLESLess Than
GRT blockGRTGreater than
MOV blockMOVMove
CLR blockCLRClear
COP blockCOPCopy File
FLL blockFLLFile Fill
AOI Runner blockAOI RunnerAOI Runner
PLC Controller Suite blockPLC Controller SuitePLC Controller
PLC Controller blockPLC ControllerPLC Controller
Task blockTaskTask
Program blockLadder Diagram ProgramLadder Diagram Program
Subroutine blockLadder Diagram SubroutineLadder Diagram Subroutine
Function Block (AOI) blockLadder Diagram Function Block (AOI)Ladder Diagram Function Block (AOI)
Variable Read blockVariable ReadVariable Read
Variable Write blockVariable WriteVariable Write
Power Rail Start blockPower Rail StartPower Rail Start
Power Rail Terminal blockPower Rail TerminalPower Rail Terminal
RungTerminal blockRung TerminalRung Terminal
Junction blockJunctionJunction
Custom Instruction blockCustom InstructionCreate custom ladder logic instruction

Topics

Featured Examples