Programming concepts
5.7 PLC error reaction
S7-200 SMART
110 System Manual, 09/2015, A5E03822230-AC
Non-fatal errors and I/O errors
The CPU does not change to STOP mode when it detects a non-fatal error. It only logs the
event in SM memory and continues with the execution of your program. However, you can
design your program to force the CPU to STOP mode when a non-fatal error is detected.
The following sample program shows a network of a program that is monitoring two of the
global non-fatal error bits and changes the CPU to STOP whenever either of these bits = 1.
Table 5- 3 Example logic for detecting a non-fatal error condition
When an I/O error or a run-time error
occurs, go to STOP mode
LD SM5.0
O SM4.3
STOP
Non-fatal errors are those indicating problems with the construction of the user program or
with certain instruction execution problems in the user program. I/O errors are those
indicating problems with the I/O of the CPU, signal board, and expansion modules. You can
use STEP 7-Micro/WIN SMART to view the error codes that were generated by the non-fatal
and I/O errors.
Click the PLC button from the Information section of the PLC menu ribbon strip, to see the
current error status of a PLC connected to STEP 7-Micro/WIN SMART.
Table 5- 4 Non-fatal error types
Program-compile
errors in the CPU
The CPU compiles the program as it downloads. If the CPU detects that the program violates a
compilation rule, the download is aborted and an error code is generated. (A program that was
already downloaded to the CPU would still exist in the permanent memory and would not be lost.)
After you correct your program, you can download it again.
I/O device errors After power-up and after a system block download, the CPU verifies that the I/O configuration
stored in the system block matches the CPU, signal board, and expansion modules that are actual-
ly present. Any mismatch results in the generation of a configuration error for the device. During
runtime, other I/O problems (such as missing user power or input value exceeding limits) that are
detected by a device can generate an I/O error.
The module status information is stored in special memory (SM) bits. Your program can monitor
and evaluate these bits. SM5.0 is the global I/O error bit and remains set while any I/O error condi-
Program execution
errors
Your program can create error conditions while being executed. These errors can result from im-
proper use of an instruction or from the processing of invalid data by an instruction. For example,
an indirect-address pointer that was valid when the program compiled could be modified during the
execution of the program to point to an out-of-range address. This is an example of a run-time
programming problem. SM4.3 is set upon the occurrence of a run-time programming problem and
remains set while the CPU is in RUN mode.
You can get any non-fatal error code and reset SM4.3 to OFF by executing the GET_ERROR in-
struction.