Technical data

Table Of Contents
Organization Blocks
System Software for S7-300/400 System and Standard Functions - Volume 1/2
A5E00709327-01
1-61
1.27 Programming Error Organization Block (OB121)
Description
The operating system of the CPU calls OB121 whenever an event occurs that is
caused by an error related to the processing of the program. For example, if your
program calls a block that has not been loaded on the CPU, OB121 is called.
Understanding the Operation of the Programming Error OB
OB121 is executed in the same priority class as the interrupted block.
If OB121 is not programmed, the CPU changes from the RUN mode to the STOP
mode.
S7 provides the following SFCs for masking and unmasking start events for OB121
during the execution of your program:
SFC36 (MSK_FLT): masks specific error codes
SFC37 (DMSK_FLT): unmasks the error codes that were masked by SFC36
SFC38 (READ_ERR): reads the error register
Local Data for the Programming Error OB
The following table describes the temporary (TEMP) variables for programming
error OB. The variable names are the default names of OB121.
Variable Type Description
OB121_EV_CLASS BYTE Event class and identifiers: B#16#25
OB121_SW_FLT BYTE Error code :
(possible values: B#16#21, B#16#22, B#16#23,
B#16#24, B#16#25, B#16#26, B#16#27, B#16#28,
B#16#29, B#16#30, B#16#31, B#16#32, B#16#33,
B#16#34, B#16#35, B#16#3A, B#16#3C, B#16#3D,
B#16#3E, B#16#3F)
OB121_PRIORITY BYTE Priority class = priority class of the OB in which the error
occurred
OB121_OB_NUMBR BYTE OB number (121)
OB121_BLK_TYPE BYTE Type of block where the error occurred (no valid value is
entered here in case of S7-300): B#16#88: OB,
B#16#8A: DB, B#16#8C: FC, B#16#8E: FB
OB121_RESERVED_1 BYTE Reserved
OB121_FLT_REG WORD Source of the error (depends on error code).
For example:
Register where the conversion error occurred
Incorrect address (read/write error)
Incorrect timer/counter/block number
Incorrect memory area