Creating a user program
1.6 Compiling and downloading blocks
Effects of a load operation on the tag values of a data blocks
When data blocks are downloaded to a device in STOP operating state, the next transition of
the device to RUN affects the current tag values as follows:
● Tags of non-retentive data blocks retain their defined start values.
● Tags of retentive data blocks only retain their values if the following conditions are met:
– You loaded the data block by means of "Download to device > Software (changes only)".
– You made no changes to the DB structure.
Otherwise the tags of retentive data blocks also retain their defined start values.
1.6.3.2 Downloading blocks in the "RUN" operating state to the device
Basics about downloading blocks in the "RUN" operating state
When you download modified blocks to a device, it is not always necessary to change the
device to the "STOP" operating state. During a downloading process the Engineering System
therefore checks whether the device has to be stopped before downloading. The result of the
check is displayed in the "Load preview" dialog.
If it is necessary to change to the "STOP" operating state, you cannot continue the download
process until you have stopped the CPU.
If the requirements are met, you can also download a modified program or program parts to
a CPU in "RUN" operating state.
Fundamentally there are the following limitations for a downloading process in the "RUN"
operating state:
● Depending on the device used, the number and the type of blocks that you can download
in the "RUN" operating state can be limited.
● You have the option to download the blocks to the device in RUN over multiple cycles. This
is only possible when you use the "Download > Software (only changes)" command.
● It is not possible to load all the blocks using "Download PLC program to the device and
reset".
● If you have changed the hardware configuration of the device that is to be used as the target
of the downloading process, downloading in the "RUN" operating state is not possible.
Note
Actual parameters are not overwritten by a download process in the "RUN" operating state.
Changes to the actual parameters will not become effective until the next time you change the
operating state from "STOP" to "RUN".
Programming the PLC
590 Programming and Operating Manual, 12/2014
Creating a user program
1.6 Compiling and downloading blocks
Downloading changes in "RUN"
The table below shows which program and configuration changes can be downloaded in "RUN"
operating state, sorted by CPU family and taking into consideration the firmware versions of
the CPUs.
Explanations on the table:
● "RUN": Change can be downloaded in "STOP" operating state as well as in "RUN" operating
state to the CPU.
● "RUN (< 57)": The CPU can integrate up to 56 new or modified objects/blocks in one
program cycle. If you download more objects/blocks, they are integrated in several
successive program cycles. If you want to download all objects/blocks consistently, you
must set the CPU to "STOP" operating state. This number depends on the setting for
S7-300 CPUs with configuration option "Process mode/test mode".
● "RUN (Init)": Change can be downloaded in "RUN" operating state; downloaded data blocks
are re-initialized.
● "STOP": Change can only be downloaded in "STOP" operating state.
● "STOP (Reset)": Change can only be downloaded in "STOP" operating state; all data
including retentive data is reset.
S7-300 S7-400 S7-1200 V4.0 S7-1500
and higher
Action/type of change Download possible in operating state ...
Modified properties of HW components. STOP STOP STOP STOP
This includes changes to comments in the
HW configuration.
Added HW components STOP STOP STOP STOP
New/revised text lists (alarms) RUN RUN STOP RUN (V1.1 and
higher)
Revised comments (new, revised, de‐ - - RUN RUN
leted) with the exception of comments in
the HW configuration
Number of blocks downloaded at the same RUN (<17) RUN (<57) RUN (<21) RUN (all)
time
Download PLC program to the device and STOP (Reset) STOP (Reset) STOP (Reset) STOP (Reset)
reset
New OB RUN RUN STOP RUN
Modified OB: Code changes RUN RUN RUN RUN
OB with modified properties RUN RUN STOP RUN
(e.g., cycle time change)
Deleted OB RUN RUN STOP RUN
New FB/FC/DB/User Data Type (UDT) RUN RUN RUN RUN
Deleted FB/FC/DB/User Data Type (UDT) RUN RUN RUN RUN
Revised FB/FC: Code change RUN RUN RUN RUN
Revised FB/FC: Interface change* STOP STOP RUN RUN
Programming the PLC
Programming and Operating Manual, 12/2014 591
Creating a user program
1.6 Compiling and downloading blocks
S7-300 S7-400 S7-1200 V4.0 S7-1500
and higher
Action/type of change Download possible in operating state ...
Modified DB: Modified property ("Only STOP STOP RUN (Init) RUN (Init)
store in load memory" attribute changed)
Modified DB (memory reserve not ena‐ RUN (Init) RUN (Init) RUN (Init) RUN (Init)
bled): Name/type of tags modified, tags
added or deleted **
Modified DB (memory reserve enabled): - - RUN RUN
New tags added**
Modified User Data Type (UDT) STOP STOP RUN (Init) RUN (Init)
Add new PLC tags (timer, counter, bit RUN RUN RUN RUN
memory)
Modified retentivity settings (timer, coun‐ STOP STOP STOP STOP
ter, bit memory, DB area)
Motion Control technology objects: - - - STOP
Changes to MC Servo cycle clock, change
from free-running to cyclical (and vice ver‐
sa). Changes to the HW interface of the TO
* If the interface change results in structural changes at the instance DB, see "Modified DB...".
** For information on the effect of downloading data block changes on the data block content, see section "Downloading data
blocks to the CPU".
Download of changes in "RUN" with older CPU firmware versions
The table below shows which changes you can download in "RUN" operating state and for
which older CPU firmware versions.
S7-1200 S7-1200
V1.0 - 2.1 V2.2 - V3.0
Action/type of change Download possible in operating state ...
Modified properties of HW components. STOP STOP
This includes changes to comments in the HW configuration.
Added HW components STOP STOP
New/revised text lists (alarms) STOP STOP
Revised comments (new, revised, deleted) with the exception of com‐ STOP RUN
ments in the HW configuration.
Number of blocks downloaded at the same time STOP RUN (<11)
Download PLC program to the device and reset STOP (Reset) STOP (Reset)
New OB STOP STOP
Modified OB: Code changes STOP RUN
OB with modified properties (e.g., cycle time change) STOP STOP
Deleted OB STOP STOP
New FB/FC/DB/User Data Type (UDT) STOP RUN
Programming the PLC
592 Programming and Operating Manual, 12/2014
Creating a user program
1.6 Compiling and downloading blocks
S7-1200 S7-1200
V1.0 - 2.1 V2.2 - V3.0
Action/type of change Download possible in operating state ...
Deleted FB/FC/DB/User Data Type (UDT) STOP RUN
Revised FB/FC: Code change STOP RUN
Revised FB/FC: Interface change STOP STOP
Modified DB: Modified property ("Only store in load memory" attribute STOP STOP
changed)
Modified DB (memory reserve not enabled): Name/type of tags modi‐ STOP STOP
fied, tags added or deleted
Modified User Data Type (UDT) STOP STOP
Add new PLC tags (timer, counter, bit memory) STOP STOP
Modified retentivity settings (timer, counter, bit memory, DB area) STOP STOP
Downloading data blocks to the CPU
Depending on the conditions, the download of new or modified data blocks has an effect on
the actual values in the data block:
Download new data blocks Actual values in the new data blocks are set to
start values.
Download structurally modified data blocks Actual values of added tags in the structurally
(memory reserve not enabled) modified data blocks are set to start values.
Download structurally modified data blocks The following actual values are retained:
(memory reserve enabled) ● Actual values of tags outside the memory
reserve
● Actual values of tags that were not modified
within the memory reserve.
Actual values of added tags within the memory
reserve are set to start values.
Download of simply modified data blocks (no Actual values are retained.
structural modification)
Additional information
Additional information on download of block extensions without re-initialization and download
of modified values for data blocks is available at "See also".
See also
Downloading blocks in the program editor to device (Page 594)
Downloading blocks from the project tree to the device (Page 595)
Programming the PLC
Programming and Operating Manual, 12/2014 593
Creating a user program
1.6 Compiling and downloading blocks
1.6.3.3 Downloading blocks in the program editor to device
Requirement
The block to be downloaded is open.
Procedure
To download a block from the program editor to the device, follow these steps:
1. Right-click in the Instruction window of the program editor.
2. Select the "Download to device" command in the shortcut menu.
– If you have not already established an online connection, the "Extended download to
device" dialog opens. In this case set all parameters required for the connection and
click on "Download".
– You can save your preferred connection parameters as default under "Options >
Settings > Online & Diagnostics". When you first load with new connection parameters,
a query is automatically displayed whether you want to store it as a default setting. Click
"Yes", if you want to save the current connection parameters as default.
– You have the option of showing all compatible devices by selecting the corresponding
option and clicking the "Start search" command. You can also open the "Extended
download to device" dialog with the "Online" menu.
See also: Establishing and terminating an online connection
– If you have already specified an online connection, then the project data will be compiled
if necessary and the dialog "Download preview" opens. This dialog displays alarms and
proposes actions necessary for uploading.
3. Check the alarms and, where necessary, enable the actions in the "Action" column.
As soon as downloading becomes possible, the "Load" button is enabled.
Note
Actions
Performing the proposed actions during operation of the plant can cause serious damage
to property or injury to persons if there are functional disturbances or program errors!
Make sure that no dangerous situations can arise before you start the actions!
Note
To avoid inconsistencies between calling and called blocks, download all affected blocks
each time you make global changes, such as changes in the block interface. Select the
"Consistent download" action.
Programming the PLC
594 Programming and Operating Manual, 12/2014