Running and debugging IEC 61131-3 programs

Running programs in the IDE

It is possible to compile and run POUs directly in the IDE, before generating the C code and cross-compile the binary file. To run a program (in general, a POU), you can either:

Actually, the direct "Run" command, from the menu or the Ctrl-F11 shortcut invokes the last "Run configuration". This is a standard Eclipse concept, which allows to create-edit-save-invoke several customized "launch configurations", for running or debugging. See the Eclipse help if you need more info.

A "Run" command will typically execute the program body and show in the console the values of its variables.

Bear in mind that the emulator that runs the IEC-61131 code is decoupled from the device definition, and hence it cannot emulate device-specific features of the project, such as mapping of directly represented variables, schedulling of POUs execution, etc.

Debugging

Before run a program in Debug mode, you probably want to set some breakpoints first. See below to do this.

To run a program in Debug mode:

In Debug mode the IDE will suggest the user to switch to the "Debug perspective", which is recommended.

The execution will stop at the user defined breakpoints. From there, you can resume the execution or step over each instruction (F6). The Variables view will show the current values of each variable.

Setting breakpoints for debugging

Breakpoints can be set on instructions (in textual languages) or in graphical elements (in graphical languages).

Debugging with device I/O variables

IEC 61131-3 support directly addressed variables (digital and analog I/O, specific for the device) are supported via AT addressing: eg, a variable declared as X8 AT %IX8.2 : BOOL; would represent a digital input at some (device specific) "address" 8.2. The real mapping and reading of that address is implemented in the device code (provided by the OEM manufacturer), and takes place actually when the executable runs on the real device. During simulation in the IDE, these I/O variables (digital and analog) are displayed in a special panel, and the values of the inputs can be change manually by the user, during the simulation. The videos include a demo.