Obs Help You Structure Your User Program; Event Execution Priorities And Queuing - Siemens SIMATIC S7-1200 Manual

Easy book
Hide thumbs Also See for SIMATIC S7-1200:
Table of Contents

Advertisement

4.3.2

OBs help you structure your user program

OBs control the execution of the user program. Specific events in the CPU trigger the
execution of an organization block. OBs cannot call each other or be called from an FC or
FB. Only an event such as a diagnostic interrupt or a time interval, can start the execution of
an OB. The CPU handles OBs according to their respective priority classes, with higher
priority OBs executing before lower priority OBs. The lowest priority class is 1 (for the main
program cycle), and the highest priority class is 24.
4.3.3

Event execution priorities and queuing

The CPU processing is controlled by events. An event triggers an interrupt OB to be
executed. You can specify the interrupt OB for an event during the creation of the block,
during the device configuration, or with an ATTACH or DETACH instruction. Some events
happen on a regular basis like the program cycle or cyclic events. Other events happen only
a single time, like the startup event and time delay events. Some events happen when the
hardware triggers an event, such as an edge event on an input point or a high speed counter
event. Events like the diagnostic error and time error event only happen when an error
occurs. The event priorities and queues are used to determine the processing order for the
event interrupt OBs.
The CPU processes events in order of priority where 1 is the lowest priority and 26 is the
highest priority. Prior to V4.0 of the S7-1200 CPU, each type of OB belonged to a fixed
priority class (1 to 26). With V4.0, you can assign a priority class to each OB that you
configure. You configure the priority number in the attributes of the OB properties.
Interruptible and non-interruptible execution modes
OBs execute in priority order of the events that trigger them. With V4.0 of the S7-1200 CPU,
you can configure OB execution to be interruptible or non-interruptible. Note that program
cycle OBs are always interruptible, but you can configure all other OBs to be either
interruptible or non-interruptible.
If you set interruptible mode, then if an OB is executing and a higher priority event occurs
before the OB completes its execution, the running OB is interrupted to allow the higher-
priority event OB to run. The higher-priority event runs, and at its completion, the OB that
was interrupted continues. When multiple events occur while an interruptible OB is
executing, the CPU processes those events in priority order.
If you do not set interruptible mode, then an OB runs to completion when triggered
regardless of any other events that trigger during the time that it is running.
Easy Book
Manual, 03/2014, A5E02486774-AF
PLC concepts made easy
4.3 Execution of the user program
55

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents