CODESYS keeps your logic and your hardware apart. The device tree describes the physical setup โ the target, its fieldbus, the I/O modules โ and an I/O mapping ties each physical channel to a variable. Your program reads the variable, never the channel. Swap the target and your logic doesn't flinch; only the mapping moves.
The tree shows a target with an EtherCAT master and an 8-point input module; the table maps its channels to your variables (xStartPB, xLevelHiโฆ). Press ๐ Re-target to move the whole project to a different vendor's controller โ watch the target and channel addresses change while your variable names stay identical. That's portability in one click.
| Variable (your logic) | Channel (this target) |
|---|
Notice what didn't change: every variable name. Your POUs, languages and logic are written against names; the device tree and mapping are the only place hardware lives. Re-target, remap, download โ the valuable part (your program) comes along untouched. This is the mechanism behind Track 01's "write once, run anywhere."
๐ฏ Target / Device โ the controller you're running on. Swapping it re-points the whole project; CODESYS recompiles for the new runtime.
๐ Fieldbus master โ EtherCAT, PROFINET, Modbusโฆ added under the target. Imports device descriptions (ESI/GSDML) for the slaves below it (Track 06).
๐ Slave / module โ an I/O block, drive or sensor on the bus, with its channels exposed for mapping.
๐ The mapping โ the thin layer binding a channel to a variable. The only thing that's truly hardware-specific in your project.
You re-target a finished project from a Raspberry Pi to an industrial controller. What needs attention?