IEC 61131-3 Compliance: Making Your PLC Code Portable
How to write PLC code that is portable between different manufacturers. Covers IEC 61131-3 compliance levels, vendor-specific extensions to avoid, and practical portability strategies.
IEC 61131-3 Compliance: Making Your PLC Code Portable
IEC 61131-3 promises code portability between PLC manufacturers. The reality is more nuanced — while the language syntax is standardized, vendor-specific instruction sets, data types, and system functions are not. Here is how to maximize portability in practice.
The Portability Problem
Each PLC manufacturer implements IEC 61131-3 with extensions:
- Siemens: SCL (= ST + Siemens extensions), GRAPH, S7-specific system functions (SFC/SFB)
- Allen-Bradley: Add-On Instructions (AOI), FactoryTalk-specific functions
- Mitsubishi: GX Works-specific instructions, CC-Link system functions
- Schneider: Unity-specific function blocks, M580-specific features
- CODESYS-based: Most portable, but each vendor adds libraries
Code that uses only standard IEC 61131-3 instructions and data types can theoretically run on any compliant platform. Code that uses vendor-specific extensions is locked to that vendor.
What Is Portable
| Element | Portable? | Notes |
|---|---|---|
| Basic data types (BOOL, INT, DINT, REAL, TIME, STRING) | ✅ Yes | Identical across platforms |
| Standard function blocks (TON, TOF, TP, CTU, CTD, R_TRIG) | ✅ Yes | Identical interface |
| ST/SCL syntax (IF, CASE, FOR, WHILE) | ✅ Yes | Minor syntax variations |
| LD rungs (XIC, XIO, OTE equivalent) | ✅ Mostly | Visual differences but same logic |
| Arrays and Structs | ✅ Yes | Syntax may vary slightly |
What Is NOT Portable
| Element | Portable? | Notes |
|---|---|---|
| System functions (Siemens SFC/SFB, AB GSV/SSV) | ❌ No | Completely vendor-specific |
| Communication instructions (PUT/GET, MSG) | ❌ No | Different protocols, different syntax |
| Safety instructions | ❌ No | Vendor-specific safety kernels |
| Motion control | ❌ No | Completely different architectures |
| HMI integration | ❌ No | Vendor-specific tag binding |
| Diagnostics and error handling | ❌ No | Different OB/fault structures |
Practical Portability Strategy
-
Separate portable logic from vendor-specific logic. Put standard control algorithms (PID, sequencing, interlocks) in FBs that use only IEC standard instructions. Put communication, diagnostics, and HMI interface in separate vendor-specific FBs.
-
Use standard data types. Avoid vendor-specific types like S5TIME (Siemens) or ALARM_ANY. Use TIME, INT, REAL.
-
Abstract hardware access. Do not reference I/O addresses directly in control logic. Pass all I/O through a hardware abstraction layer (interface FBs or global tags). When switching vendors, only the abstraction layer changes.
-
Document vendor-specific dependencies. In every block that uses vendor-specific instructions, add a comment listing which instructions are non-portable. This saves enormous time during future migrations.
-
Use PLCopen function blocks where available. PLCopen defines standardized FBs for motion control (PLCopen Motion) and safety (PLCopen Safety) that are implemented by multiple vendors.
Frequently Asked Questions
Can I really move a program from Siemens to Allen-Bradley?
The standard control logic (IF/THEN, timers, counters, math) translates directly. But any program of real-world complexity uses vendor-specific instructions — those must be rewritten. Realistic portability: 40–70% of code transfers conceptually, 0% transfers as-is.
Is CODESYS more portable than Siemens or AB?
CODESYS-based PLCs (Beckhoff, WAGO, ABB, Bosch Rexroth) share the same runtime, making code transfer between CODESYS platforms relatively straightforward. But CODESYS code is not directly portable to Siemens or AB platforms.
Analyze your code's vendor dependencies →
Maintained by PLCcheck.ai.
Related Articles
Cross-Platform PLC Migration: Siemens to Allen-Bradley
What to expect when migrating between Siemens S7 and Allen-Bradley ControlLogix. No automatic conversion exists — this guide covers the manual approach, key differences, and planning.
8 min read
migration-guideConverting Ladder Logic to Structured Text: Why and How
When and how to convert PLC ladder logic (LD/KOP/LAD) to Structured Text (ST/SCL). Covers the benefits, conversion patterns, what to keep in ladder, and practical examples.
8 min read
migration-guideOptimized vs. Standard Data Blocks in S7-1500: What Every Migrator Must Know
Complete guide to optimized vs. standard (non-optimized) data blocks in S7-1500 and S7-1200. Architecture, performance, migration impact, PUT/GET compatibility, OPC UA, and when to use which.
12 min read
Analyze your PLC code with AI
PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.
Try PLCcheck Pro →Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.