Technical data
Diagnostics
23.9 Program Measures for Handling Errors
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 507
Sample Program for the Error OB81
The sample STL program shows how you can read the error code in OB81.
The program is structured as follows:
• The error code in OB81 (OB81FLTID) is read and compared with the value of the event
"battery exhausted" (B#16#3921).
• If the error code corresponds to the code for "battery exhausted," the program jumps to the
label Berr and activates the output batteryerror.
• If the error code does not correspond to the code for "battery exhausted," the program
compares the code with the code for "battery failure".
• If the error code corresponds to the code for "battery failure," the program jumps to the label
Berr and activates the output batteryerror. Otherwise the block is terminated.
STL Description
L B#16#21 // Compare event code "battery exhausted"
//(B#16#21) with
L #OB81_FLT_ID // the error code for OB81.
==I // If the same (battery is exhausted),
// jump to Berr.
JC Berr
L B#16#22 // Compare event code "battery failure"
//(b#16#22) with
==I // the error code for OB81.
JC BF // If the same, jump to Berr.
BEU // No message about battery failure
Berr: L B#16#39 // Compare the ID for the next event with
L #OB81_EV_CLASS // the error code for OB81.
==I // If a battery failure or an exhausted battery
// is found,
S batteryerror // set the output "battery error."
// (Variable from the symbol table)
L B#16#38 // Compare the ID for the concluding event with
==I // the error code for OB81.
R batteryerror // reset the output "battery error, when
// the error is fixed.
You can find detailed information on OBs, SFBs, and SFCs, as well as an explanation of event IDs,
in the corresponding Help on Blocks.