User Manual

PLC concepts made easy
4.3 Execution of the user program
Easy Book
Manual, 03/2014, A5E02486774-AF
53
You can configure the "startup after POWER ON" setting of the CPU complete with restart
method using STEP 7. This configuration item appears under the Device Configuration for
the CPU under Startup. At power up, the CPU performs a sequence of power-up diagnostic
checks and system initialization. During system initialization, the CPU deletes all non-
retentive bit memory and resets all non-retentive DB contents to initial values. The CPU then
enters the appropriate power-up mode. Certain errors will prevent the CPU from entering the
RUN mode. The CPU supports the following power-up modes: STOP mode, "Go to RUN
mode after warm restart", and "Go to previous mode after warm restart".
NOTICE
Warm restart mode configuration
The CPU can enter STOP mode due to repairable faults, such as failure of a replaceable
signal module, or temporary faults, such as power line disturbance or erratic power up
event.
If the CPU has been configured to "Warm restart mode prior to POWER OFF", it will not
return to RUN mode when the fault is repaired or removed until it receives a new command
from STEP 7 to go to RUN. Without a new command, the STOP mode is retained as the
mode prior to POWER OFF.
CPUs that are intended to operate independently of a STEP 7 connection should typically
be configured to "Warm restart - RUN" so that the CPU can be returned to RUN mode by a
power cycle following the removal of fault conditions.
The CPU does not provide a physical switch for changing the
operating mode. To change the operating mode of the CPU, STEP
7
provides the following tools:
"Stop" and "Run" buttons on the STEP 7 toolbar
CPU operator panel in the online tools
You can also include a STP instruction in your program to change the CPU to STOP mode.
This allows you to stop the execution of your program based on the program logic.
4.3
Execution of the user program
The CPU supports the following types of code blocks that allow you to create an efficient
structure for your user program:
Organization blocks (OBs) define the structure of the program. Some OBs have
predefined behavior and start events, but you can also create OBs with custom start
events (Page 55).
Functions (FCs) and function blocks (FBs) contain the program code that corresponds to
specific tasks or combinations of parameters. Each FC or FB provides a set of input and
output parameters for sharing data with the calling block. An FB also uses an associated
data block (called an instance DB) to maintain state of values between execution that can
be used by other blocks in the program.
Data blocks (DBs) store data that can be used by the program blocks.