Function: The command is used for initiating an online change on the current application. When this is done, CODESYS re-downloads only the changed parts of an application that is already running on the PLC.
Call: Menu bar: “Online”; context menu of an “Application” object
Requirement: The application is in online mode.
The command is available in the context menu if an application is selected in the device tree. In this way, you can perform an online change just for one application, even if that application is not currently active.




CAUTION

An online change modifies the running application program and does not cause a restart.
Make sure that the new application code still has the required effect on the controlled system.
Depending on the controlled plant, the plant and workpieces may be damaged or the health and life of persons could be endangered.




NOTICE

1. When an online change is performed, the application-specific initializations (example: homing) are not executed because the machine retains its status. For this reason, the new program code may not have the intended effect.
2. Pointer variables retain their value from the last cycle. When a pointer refers to a variable whose value was changed in an online change, the variable no longer yields the correct value. Make sure that the pointers are re-assigned in each cycle.
3. After the parent application has been changed, a child application is removed from the controller when an online change is performed.




NOTICE

For compiler version >= 3.5.0.0, a fast online change is performed for minor changes.
In this case, only the modified blocks are compiled and downloaded. In particular,
no initialization code is generated. This means that also no code is generated when
variables with the init_on_onlchange
attribute are initialized. As a rule, this has no effect because the attribute is
used primarily for initializing variables with addresses. However, it cannot happen
that a variable changes its address during an online change.
To secure the effect of the init_on_onlchange
attribute in the entire application code, you must deactivate the fast online change
in general for the application by using the compiler definition no_fast_online_change
. To do this, insert the definition in the application “Properties” (“Build” tab).
At the time of download, CODESYS also lists the changed interfaces, affected variables, and all blocks with new generated code in the “Build” category of the message view. If memory locations change, a dialog will inform you of possible problems in conjunction with pointers.
In the “Online Change Memory Reserve” view, memory reserves can be configured for the online change so that instance variables do not have to be moved in the memory when changing a function block in an online change.
What prevents an online change?
There are actions in CODESYS after which an online change on a controller is no longer possible. Afterwards, the application always has to be completely recompiled. A typical case is the “Clean All” action which deletes the compile information stored at the last download. However, these kind of actions typically generate a warning which you have to acknowledge.
But there are also "normal" editing actions that result in an online change not being
possible at the next login. Therefore, pay attention to the following symbol in the
status bar when editing in the program POUs: . When this symbol turns red in color (
), only a full download to the controller can be performed. Double-clicking the symbol
opens the “Application Information” dialog with a list of differences to the last download. In the dialog, you also find
information about which of the changes prevent an online change.
Actions and changes in different areas of an application that prevent an online change:
Check functions |
Activation or removal of a check function ( Change in an interface of a check function (also the insertion and deletion of local variables) |
Task configuration |
Change in the configuration settings |
Project settings |
Change of the “Compile Options” in the “Settings” section (Unicode, replace constants, logging in, breakpoints) Change in the “Compiler defines” |
Application properties |
Change of the “Target system memory settings” (“Build” tab) |
POU properties |
Change of the “External implementation” option (“Build” tab) |
Task-local global variable list |
All changes |
Function block |
Change of the base POU of a function block ( Change in the interface list ( |
Data type |
Change of the data type of a variable from a user-defined data type to another user-defined
data type (for example, from Change of the data type from a user-defined data type to a base type (for example,
from Note: As a workaround, you should always change the name of the variable together with the data type. Then the variable is initialized as a new variable and the old one is removed. Then an online change is possible. |
Alarm configuration |
Change in the alarm database configuration Change of the number of latch variables (also has an effect on the memory format in the database) Change to the configuration of the distributed alarms |
Data source |
All changes in the configuration |
Device configuration |
Change in the device tree (also by the “Update Device” command) Change in a device configuration: By default, changes to device parameters are not capable of online change. However, exceptions can be configured in the device description. Note: I/O mapping to variables is possible by online change. |
Visualization |
Toggling of the overlay function Before V3.5 SP6: Change in the configuration of the trace element Note: In V3.5 SP6 and higher, the following applies: For online changes that affect visualizations or affect the data of the application (for example, a new variable is inserted), the visualization is completely reinitialized. For TargetVisu, for example, this means that the visualization closes and reopens with the start page. For WebVisu, the visualization also restarts with the start visualization after a short waiting period. |
Unit conversion |
Insertion or removal of objects for unit conversion |
Trend |
Change of the number of variables or maximum number of variables. Change of the number of variables with a description or special line settings |