Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 109482083, Entry date: 03/01/2016

How can an overflow of arithmetic operations in the fail-safe program be intercepted?

  • Entry
  • Associated product(s)
With the release of the fail-safe controllers of the SIMATIC S7-1200 and S7-1500 controller series, an evaluation of the overflow bit is not possible anymore. If an overflow occurs, the controller may switch to the operation mode Stop caused by data corruption or an internal CPU error.

In order to intercept a possible overflow of an arithmetic operation in the fail-safe program and to avoid the resulting change of operation mode to Stop, several functions for the arithmetic operations addition, subtraction, multiplication and division were developed.

These functions evaluate in the fail-safe program if the result of the arithmetic operation will be located outside the permitted range for this data type. If that's the case, the arithmetic operation will not be executed and an output will be set to signal the avoided overflow. Otherwise the arithmetic operation will be executed and the result will be output.

 result overflowDescription
 0 1Overflow detected. Arithmetic operation was not executed.
 Result 0Arithmetic operation was executed succesfully.

For each of these arithmetic operations two functions are available: one for the data type Integer and one for the data type Double Integer. The following figure shows the four functions for the data type Integer.

Fig. 01

  • STEP 7 Professional V13 SP1

  • STEP 7 Safety Basic/Advanced V13 SP1

  • SIMATIC S7-1200 or S7-1500

 Registrierung notwendig  Library LFMath V1.0 for STEP 7 V13 SP1 (1,7 MB)

Additional keywords

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit