CODESYS Tutorial: Getting Started in 30 Minutes
From a blank development PC to a running ladder logic program, simulating in CODESYS Control Win. Installation, project creation, your first POU, building, downloading, and forcing I/O.
Why CODESYS?
CODESYS is the most widely-OEM'd PLC programming environment in the world. Beckhoff TwinCAT, Schneider Machine Expert, Wago e!Cockpit, ABB AC500 and dozens of vendor IDEs are built on CODESYS — so learning it gives you transferable skills across many platforms. The Development System is free for personal/educational use, and CODESYS Control Win lets you run a full PLC runtime on your own PC for testing without any hardware.
Step 1: Download and install
- Go to
store.codesys.comand create a free account. - Download the latest CODESYS Development System V3.5.
- Also download CODESYS Control Win V3 — the SoftPLC runtime for testing on your PC.
- Install both. Reboot when prompted.
Step 2: Create your first project
- Launch CODESYS. File → New Project.
- Select Standard project. Click OK.
- Name your project (e.g.,
FirstSteps). - Choose Device: CODESYS Control Win V3 x64 and PLC_PRG language: Ladder Diagram (LD). OK.
CODESYS opens with a project tree showing Device → PLC Logic → Application → MAIN (PRG).
Step 3: Write a ladder program (motor seal-in)
Double-click MAIN. In the variables section, declare:
PROGRAM MAIN
VAR
Start : BOOL;
Stop : BOOL := TRUE; (* NC: TRUE means not pressed *)
Motor : BOOL;
END_VARIn the ladder editor, build a classic seal-in: Start in series with Stop, with Motor in parallel with Start as the seal-in contact, energising the Motor coil.
Step 4: Build and simulate
- Build → Build (F11). Watch for 0 errors.
- Make sure CODESYS Control Win V3 is running (green icon in system tray; right-click → Start PLC).
- Online → Login (Alt+F8). Confirm prompts about loading the application.
- Online → Start (F5). The PLC is now running your code.
Step 5: Force I/O and observe
- In the variables section, click Prepared value column for
Start; enterTRUE. - Debug → Write values (Ctrl+F7).
Motorturns TRUE. - Set
Startback toFALSEand write again.Motorstays TRUE — seal-in works. - Set
StoptoFALSE(NC button pressed).Motordrops.
That's a complete dev cycle: write → build → download → run → force → observe.
Step 6: Connect to real hardware (optional)
CODESYS-compatible hardware:
- • Beckhoff CX series (TwinCAT 3 is CODESYS-derived)
- • Wago PFC200 with e!Cockpit
- • Schneider M241/M251/M262 with Machine Expert
- • ABB AC500
- • Raspberry Pi with CODESYS Runtime for Pi (paid licence after 30-day trial)
- • Industrial Shields Arduino-compatible boards
In the Device tree, right-click → Update Device to switch targets. Your application code stays the same — IEC 61131-3 portability.
What to learn next
- • Function blocks: encapsulate reusable logic — far cleaner than copy-pasted ladder rungs.
- • Structured Text: for math, loops, string handling, ST is dramatically more readable.
- • CODESYS Visualisation: built-in HMI editor — drag widgets, bind to variables.
- • Modbus TCP server: add the Modbus library to expose variables to external clients.
- • OPC UA server: built into Control Win — turn on UA server in device config to publish to SCADA.