Online Functions

The available online commands are assembled under the menu item "Online". The execution of some of the commands depends upon the active editor. The online commands become available only after logging in.
Thanks to 'Online Change' functionality you have the possibility of making changes to programs on the running controller. See in this connection 'Online' 'Log-in'

'Online' 'Login' Shortcut: <F11>

This command combines the programming system with the PLC (or starts the simulation program) and changes into the online mode.
If the current project has not been compiled since opening or since the last modification, then it is compiled now (as with "Project" "Build"). If errors occur during compilation, then TwinCAT PLC Control does not change into Online mode.
If the current project was changed on the controller since the last download, but not closed, and if the last download information was not deleted with the command 'Project' 'Clear all', then after the command 'Login' a dialog opens with the question: „The program has been changed. Load changes? (Online Change)“. By answering Yes you confirm that, on log-in, the modified portions of the project are to be loaded onto the controller. No results in a log-in without the changes made since the last download being loaded onto the controller. Cancel cancels the command. <Load all> causes the entire project to be reloaded onto the controller.

After a successful login all online functions are available (if the corresponding settings in 'Project' 'Options' category 'Build' have been entered).
Use the "Online" "Logout" command to change from online back to offline mode.

Error case

Error: "A connection to the PLC could not be established"

Check if your TwinCAT System runs (TwinCAT Icon in Taskbar is green). If not started, start the TwinCAT system by right mouse click on the icon then select system and start. The colour of the TwinCAT icon changes from red to green.

Error: "The program has been modified! Should the new program be loaded?"
The project which is open in the editor is incompatible with the program currently found in the PLC. Monitoring and debugging is therefore not possible. You can either choose "No," logout, and open the right project, or use "Yes" to load the current project in the PLC.

Message: „The program has been changed. Load changes? (ONLINE CHANGE)“.
The project is running on the controller. The target system supports 'Online Change' and the project has been altered on the controller with respect to the most recent download or the most recent Online Change. You may now decide whether these changes should be loaded with the controller program running or whether the command should be cancelled. You can also, however, load the entire compiled code by selecting the Load all button.

'Online' 'Logout' Shortcut: <F12>

The connection to the PLC is broken. Use the "Online" "Login" command to change to the online mode.

'Online' 'Download'

This command loads the compiled project in the PLC (download, not to mistake with 'Online''download source code'!).
Download information is saved in a file called <projectname>0000000ar.ri , which is used during Online Change to compare the current program with the one most recently loaded onto the controller, so that only changed program components are reloaded. This file is erased by the command 'Project' 'Clear all'.

'Online' 'Run' Shortcut: <F5>

This command starts the program in the PLC or in Simulation Mode. This command can be executed immediately after the "Online" "Download" command, or after the user program in the PLC has been ended with the "Online" "Stop" command, or when the user program is at a break point, or when the 'Online' 'Single Cycle' command has been executed.

'Online' 'Stop' Shortcut: <Shift>+>F8>

Stops the execution of the program in the PLC or in Simulation Mode between two cycles. Use the "Online" "Run" command to restart the program.

'Online' 'Reset'

This command resets - with exception of the retain variables (VAR RETAIN) - all variables to that specific value, with which they have got initialized (also those variables which have been declared as VAR PERSISTENT !). If you have initialized the variables with a specific value, then this command will reset the variables to the initialized value. All other variables are set at a standard initialization (for example, integers at 0). As a precautionary measure, TwinCAT PLC Control asks you to confirm your decision before all of the variables are overwritten. The situation is that which occurs in the event of a power failure or by turning the controller off, then on (warm restart) while the program is running. Use the 'Online' 'Run' command to restart the program.

‘Online’ ‘Reset All’

This command resets all variables including the persistent ones ( PERSISTENT) to their initialization values and erases the user program on the controller. The controller is returned to its original state.

'Online' 'Toggle Breakpoint' Shortcut: <F9>

This command sets a breakpoint in the present position in the active window. If a breakpoint has already been set in the present position, that breakpoint will be removed. The position at which a breakpoint can be set depends on the language in which the POU in the active window is written. In the Text Editors (IL, ST), the breakpoint is set at the line where the cursor is located, if this line is a breakpoint position (recognizable by the dark-gray color of the line number field). You can also click on the line number field to set or remove a breakpoint in the text editors. In FBD and LD, the breakpoint is set at the currently selected network. In order to set or remove a breakpoint in the FBD or LD Editor, you can also click on the network number field. In SFC, the breakpoint is set at the currently selected step. In SFC you can also use <Shift> with a doubleclick to set or remove a breakpoint. If a breakpoint has been set, then the line number field or the network number field or the step will be displayed with a light-blue background color. If a breakpoint is reached while the program is running, the program will stop, and the corresponding field will be displayed in a red background color. In order to continue the program, use the "Online" "Run", "Online" "Step in", or "Online" "Step Over" commands.
You can also use the Breakpoint dialog box to set or remove breakpoints.

'Online' 'Breakpoint Dialogbox'

This command opens a dialog box to edit breakpoints throughout the entire project. The dialog box also displays all breakpoints presently set.
In order to set a breakpoint, choose a POU in the POU combobox and the line or the network in the Location combobox where you would like to set the breakpoint; then press the Add button. The breakpoint will be added to the list.
In order to delete a breakpoint, highlight the breakpoint to be deleted from the list of the set breakpoints and press the Delete button. The Delete All button can be used to delete all the breakpoints.
In order to go to the location in the editor where a certain breakpoint was set, highlight the respective breakpoint from the list of set breakpoints and press the Go to button.
To set or delete breakpoints, you can also use the 'Online' 'Toggle Breakpoint' command.

Online Functions 1:

Breakpoint Editing Dialog Box

'Online' 'Step Over' Shortcut: <F10>

This command causes a single step to execute. If a POU is called, the pro-gram stops after its execution. In SFC a complete action is executed. If the present instruction is the call-up of a function or of a function block, then the function or function block will be executed completely. Use the "Online" "Step In" command, in order to move to the first instruction of a called function or function block. If the last instruction has been reached, then the program will go on to the next instruction in the POU.

'Online' 'Step In' Shortcut: <F8>

A single step is executed. The program is stopped before the first instruction of a called POU. If necessary, there will be a changeover to an open POU. If the present position is a call-up of a function or of a function block , then the command will proceed on to the first instruction in the called POU. In all other situations, the command will function exactly as "Online" "Step Over".

'Online' 'Single Cycle' Shortcut: <Ctrl>+<F5>

This command executes a single PLC Cycle and stops after this cycle. This command can be repeated continuously in order to proceed in single cycles. The Single Cycle ends when the "Online" "Run" command is executed.

'Online' 'Write Values' Shortcut: <Ctrl>+<F7>

With this command, one or more variables are set – one time only! – to user defined values at the beginning of a cycle.
The values of all single-element variables can be changed, so long as they are also visible in Monitoring.
Before the command 'Write values' can be executed, a variable value must be ready to be written.

1. Define the values

Online Functions 2:

Dialog Box for Writing a New Variable Value.

The value set for Writing is displayed in brackets and in turquoise colour behind the former value of the variable. e.g. a=0 <:=34>.

Online Functions 3:

Exception: In the FBD and LD Editor the value is shown turquoise without brackets next to the variable name.

Set the values for as many variables as you like.
The values entered to be written to variables can also be corrected or deleted in the same manner. This is likewise possible in the 'Online' 'Write/Force dialog' (see below).
The values to be written that were previously noticed are saved in a writelist (Watchlist), where they remain until they are actually written, deleted or transferred to a forcelist by the command 'Force values'.

2. Write the values

The command to Write Values can be found at two places:

When the command 'Write values' is executed, all the values contained in the writelist are written, once only , to the appropriate variables in the controller at the beginning of the cycle, then deleted from the writelist. (If the command 'Force values' is executed, the variables in question are also deleted from the writelist, and transferred to the forcelist!)

Online Functions 4:

In the sequential function chart language (SFC), the individual values from which a transition expression is assembled cannot be changed with 'Write values'. This is due to the fact that in monitoring the 'Total value' of the expression, not the values of the individual variables are displayed (e.g. "a AND b" is only displayed as TRUE if both variables actually have the value TRUE).
In FBD, on the other hand, only the first variable in an expression, used for example as input to a function block, is monitored. Thus a 'Write values' command is only possible for this variable.

'Online' 'Force values' Shortcut: <F7>

With this command, one or more variables are permanently set to user-defined values. The setting occurs in the run-time system, both at the beginning and at the end of the cycle.
The time sequence in one cycle: 1.Read inputs, 2. Force values 3. Process code, 4. Force values 5. Write outputs.
The function remains active until it is explicitly suspended by the user (command 'Online' 'Release force') or the programming system is logged-out.
For setting the new values, a writelist is first created, just as described under 'Online' 'Write values'. The variables contained in the writelist are accordingly marked in Monitoring. The writelist is transferred to a forcelist as soon as the command 'Online' 'Force values' is executed. It is possible that an active forcelist already exists, in which case it is updated as required. The writelist is then emptied and the new values displayed in red as 'forced'. Modifications of the forcelist will be transferred to the program with the next 'Force values' command.

The forcelist is created at the first forcing of the variables contained in the writelist, while the writelist existed prior to the first writing of the variables that it contains.

The command for forcing a variable, which means that it will be entered into the forcelist can be found at the following places:

In the sequential function chart language, the individual values from which a transition expression is assembled cannot be changed with 'Force values'. This is due to the fact that in monitoring the 'Total value' of the expression, not the values of the individual variables are displayed (e.g. "a AND b" is only displayed as TRUE if both variables actually have the value TRUE).
In FBD, on the other hand, only the first variable in an expression, used for example as input to a function block, is monitored. Thus a 'Force values' command is only possible for this variable.

'Online' 'Release Force' Shortcut: <Shift>+<F7>

This command ends the forcing of variable values in the controller. The variable values change again in the normal way.
Forced variables can be recognized in Monitoring by the red color in which their values are displayed. You can delete the whole forcelist, but you can also mark single variables for which the forcing should be released.
To delete the whole forcelist, which means to release force for all variables, choose one of the following ways:

To release force only for single variables you have to mark these variable first. Do this in one ways described in the following. After that the chosen variables are marked with an turquoise extension <Release Force>:

When for all desired variables the setting “<Release Force>” is shown in the declaration window, choose the command ‘Force’ to transfer the modifications of the forcelist to the program.
If the current writelist (see 'Online' 'Write Values') is not empty while you execute the command ‘Release Force’, the dialog 'Remove Write-/Forcelist’ will be opened. There the user has to decide whether he just wants to Release Force or additionally wants to Remove the writelist or if he wants to remove both lists.

Online Functions 5:

'Online'Write/Forcen Dialog'

This command leads to a dialog which displays in two registers the current writelist (Watchlist) and forcelist (Forcelist). Each variable name and the value to be written to it or forced on it are displayed in a table.

Online Functions 6:

The variables reach the watchlist via the commands 'Online' 'Write Values' and are transferred to the forcelist by the command 'Online' 'Force Values'. The values can be edited here in the „Prepared Value“ or „Forced Value“ columns by clicking the mouse on an entry to open an editor field. If the entry is not type-consistent, an error message is displayed. If a value is deleted, it means that the entry is deleted from the writelist or the variable is noticed for suspension of forcing as soon as the dialog is closed with any other command than Cancel.
The following commands, corresponding to those in the Online menu, are available via buttons:

Force Values: All entries in the current writelist are transferred to the forcelist, that is the values of the variables in the controller are forced. All variables marked with 'Release Force' are no longer forced. The dialog is then closed.

Write Values: All entries in the current writelist are written once only to the corresponding variables in the controller. The dialog is then closed.

Release Force: All entries in the forcelist will be deleted or, if a writelist is present, the dialog “Delete write-/forcelist” comes up, in which the user must decide whether he only wants to release forcing or discard the writelist, or both. The dialog will close at that point, or after the selection dialog is closed as the case may be.

'Online' 'Show Call Stack'

You can run this command when the PLC stops at a breakpoint. You will be given a dialog box with a list of the POUs currently in the Call Stack

Online Functions 7:

Example of a Call Stack

The first POU is always the in the appointed debug task called program, because this is where the executing begins.
The last POU is always the POU being executed. After you have selected a POU and have pressed the Go to button, the selected POU is loaded in its editor, and it will display the line or network being processed.

'Online' 'Flow Control'

If you have selected the flow control, then a check will appear in front of the menu item. Following this, every line or every network will be marked which was executed in the last PLC Cycle. The line number field or the network number field of the lines or networks which just run will be displayed in green. An additional field is added in the IL-Editor in which the present contents of the accumulator are displayed. In the graphic editors for the Function Block Diagram and Ladder Diagram, an additional field will be inserted in all connecting lines not transporting any Boolean values. When these Out- and Inputs are verified, then the value that is transported over the connecting line will be shown in this field. Connecting lines that transport only Boolean values will be shaded blue when they transport TRUE. This enables constant monitoring of the information flow.

'Online' 'Simulation'

Simulation Mode is only accessibly for Buscontroller BC and not for TwinCAT PC. If Simulation Mode is chosen, then a check will appear in front of the menu item. In the simulation mode, the user program runs on the same PC under Windows. This mode is used to test the project. The communication between the PC and Simulation Mode uses the Windows Message mechanism. If the program is not in simulation mode, then the program will run on the PLC. The status of this flag is stored with the project.

'Online' 'Communication Parameters'

The parameters for transferring through the serial interface can be entered in a dialog box. It is important that these parameters agree with those entered in the PLC .

Online Functions 8:

Dialog box for Entering Communication Parameters
Possible adjustments include: the baudrate; whether the transfer should be made with Even, Odd, or No Parity; the number of Stop Bits; and also the interface (COM1, COM2, etc.) via which the transfer is to occur. The selected parameters are stored with the project.

'Online' 'Choose Runtime System'

Only TwinCAT PC:

You can choose a runtime system. You see the local (max. four) and remote accessible runtime systems.

Online Functions 9:

The runtime system information will be stored in the PLC project file after saving. Therefore, the selected port number is visible then in the TwinCAT System Manager configuration after a rescan.

Online’ ‘Sourcecode download’

This command loads the source code for the project into the controller system. This is not to be confused with the Code that is created when the project is compiled! You can enter the options that apply to Download (time, size) in the 'Project' 'Options' 'Sourcedownload' dialog.

‘Online’ 'Create bootproject’

With this command (done online), the compiled project is set up on the controller in such a way that the controller can load it automatically when restarted. Storage of the boot project occurs differently depending on the target system. For example a file is created on the PC in the TwinCAT boot directory: TCPLC_P_x.wbp (x is the number of the run time system 1 up 4).

‘Online’ 'Create bootproject (offline)’

With this command, the compiled project is set up in the project folder together with the *.pro file. Storage of the boot project occurs differently depending on the target system. For example a file is created on a PC with WinXP the name will be TCPLC_P_x.wbp (x is the number of the run time system 1 up 4). The controller can load this boot project, if the user copies the file into the TwinCAT Boot folder manually.

‘Online’ 'Write file to controller’

This command is used for loading any desired file onto the controller. It opens the dialog for 'Write file to controller' in which you can select the desired file. After the dialog is closed using the 'Open' button, the file is loaded into the controller and stored there under the same name. The loading process is accompanied by a progress dialog.
With the command 'Online' 'Load file from controller' you can retrieve a file previously loaded on the controller.

‘Online’ 'Load file from controller’

With this command, you can retrieve a file previously loaded into the controller using 'Online' 'Write file to controller'. You receive the 'Load file from controller' dialog. Under Filename, provide the name of the desired file, and in the selection window enter the directory on your computer into which it is to be loaded as soon as the dialog is closed with the „Save“ button.

The following menue entries are enabled, if the target system is BCxxxx:


'Online' 'coupler'

The following special commands are available:

K-Bus Reset: A reset of the Terminal bus is performed

Coupler Reset: The coupler will be restarted

Vendor Configuration: The factory default settings will be loaded (Boot Project erased), the coupler must be subsequently restarted by initiating a coupler reset.

Start Cycle Time Measuring: The cycle-time measurement on the BCxxxx will be started.

Stop Cycle Time Measuring: The cycle-time measurement on the BCxxxx will be stopped

Read Cycle Time Measuring: he minimum cycle-time (since measurement start), maximum cycle-time, average cycle-time (taken from the last 200 cycles) , actual cycle-time and the number of PLC-cycles will be read.

Set Cycle Time: The target cycle-time and background task time can be set here. If the actual cycle-time exceeds the target cycle-time the next cycle-time will be correspondingly late (there is no longer a constant cycle). In general the target cycle-time is calculated as follows: 1.25 times the average cycle-time (from cycle measure read), background task time: 0.25 times the average cycle-time. The time can be set to a specified value to an accuracy of 1ms.

Online Functions 10: