CODESYS keeps your logic and your hardware apart. The device tree describes the physical setup: the target, its fieldbus and the I/O modules. An I/O mapping ties each physical channel to a variable. Your program reads the variable instead of the channel directly. When you swap the target, the logic stays the same and you change the mapping.
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 project to a different vendor's controller. Watch the target and channel addresses change while your variable names stay identical.
| Variable (your logic) | Channel (this target) |
|---|
The variable names didn't change when you switched targets. Your POUs, languages and logic refer to those names; the device tree and mapping hold the hardware configuration. Re-target the project, remap its channels, then download the same program. This is how the separation described in Track 01 lets you move a program between controllers.
๐ฏ Target / device is the controller you're running on. Changing it re-points the project to that controller, and CODESYS recompiles for the new runtime.
๐ Fieldbus master is added under the target: EtherCAT, PROFINET or Modbus, for example. It imports device descriptions (ESI/GSDML) for the slaves below it (Track 06).
๐ Slave / module is an I/O block, drive or sensor on the bus. Its channels are exposed so you can map them to program variables.
๐ The mapping binds a channel to a variable. Together with the device tree above it, it holds the hardware-specific part of your project; your POUs do not change.
You re-target a finished project from a Raspberry Pi to an industrial controller. What needs attention?