Basics of program execution
5.1 Events and OBs
CPU 1516pro-2 PN (6ES7516-2PN00-0AB0)
48 Operating Instructions, 09/2016, A5E35873416-AA
Assignment between event source and OBs
The type of OB determines where you make the assignment between OB and event source:
● With hardware interrupts and isochronous mode interrupts, the assignment is made
during the configuration of the hardware or when the OB is created.
● For MC servo, MC pre-servo, MC post-servo and MC interpolator, STEP 7 automatically
assigns OBs 91/92 as soon as a technology object is added.
● For all other types of OB, the assignment is made when the OB is created, where
applicable after you have configured the event source.
For hardware interrupts, you can change an assignment which has already been made
during runtime with the instructions ATTACH and DETACH. In this case, only the actually
effective assignment changes, and not the configured assignment. The configured
assignment takes effect after loading, and upon each startup.
The CPU ignores hardware interrupts to which you did not assign an OB in your
configuration or which occur after the DETACH instruction. The check as to whether an OB
is assigned to an event does not take place when the associated event occurs, but only
when the hardware interrupt actually has to be executed.
OB priority and runtime behavior
If you have assigned an OB to the event, the OB has the priority of the event. The CPU
supports the priorities 1 (lowest priority) to 26 (highest priority). The following items are
essential to the execution of an event:
● Call and execution of the assigned OB
● The update of the process image partition of the assigned OB
The user program processes the OBs exclusively on a priority basis. This means the
program processes the OB with the highest priority first when multiple OB requests occur at
the same time. If an event occurs that has a higher priority than the currently active OB, this
OB is interrupted. The user program processes events of the same priority in order of
occurrence.
Note
Communication
The communication (e.g. test functions with the PG) always works with priority 15. To
prevent extending the program runtime unnecessarily in time
-critical applications, these OBs
should not be interrupted by communication. Assign a priority > 15 for these
OBs.
You can find additional information on organization blocks in the STEP 7 online help.