Every variable or input of a function block may have its initial value defined. This value is used at the first execution of the program after it has been uploaded to the PLC and run, after a cold restart (when the variable values from memory are not used), or after upload of a Solution and program launching as Run as after warm restart and Clear FLASH variables. In the latter case, only Retain values are taken from the PLC memory, all other variables are run with their predefined initial values.
The initial value of a variable is defined at the time of creating a new variable in the FUPLA/ST editor. Both global and local variables may have initial values. The initial value is visible in the Variable properties in the FUPLA editor:
When working in the ST Editor the initial values are displayed in the declaration part, and global variables are defined in the generated.st file.
The initial values are now also visible and editable in the Variable browser. Next to the PLC Value column which shows the variable value read from the running PLC, there is the Initial value column which displays the initial value, as defined in your project. Note that the column layout in the Variable browser may be modified by dragging columns to their new position.
Function blocks inputs may also possess an initial value. Again, it can be set both in FUPLA, ST editor and in the Variable browser.
If the value in the table is bold, it has been changed and is different from the default initial value which the block had after being inserted into the FUPLA editor.
In the structured text, the initial value can be set right in the declaration part.
The last place to see the inputs initial value is the Variable browser again. After a block is expanded, all its inputs are visible, including inputs of embedded blocks.
Every function block instance is listed separately. It is thus possible to set the initial values of inputs of every block on a separate basis and independently. If there is no initial value set in the Variable browser, the initial value set in the block source code is used, regardless if the block was inserted in FUPLA or as a instance in ST.
If there is a value changed in the Variable browser, this new value will be used.
After resetting of the corresponding value in the Variable browser (by clicking the "R" button in the focused Initial value field), the original source code default value will be used.
Initial values of time schedulers can be set in the same way as the initial values of the function blocks. Note that if Debug mode is active and Idekit Studio is connected to a running Runtime, the editor available in the Time scheduler properties edits values in the running Runtime directly. If debug is off, the editor edits the initial values of the time scheduler.