If there are software or hardware errors in the plc, you may not want to catch the error or stop your whole system due to the error.
In these cases, you can use a fault routine to clear the fault and allow some part of your system to continue running. Failure routine runs the routines you specify in major or minor faults.
For example, in the indirect addressing type used due to overflow or incorrect addressing, the plc also occurs with the type 4 code 20 error.
Type 4 code 20 error :Array subscript too big, control structure .POS or .LEN is invalid error, can be cleared with this method.
It is important where to place the fault routine to find the fault. So choose where to place the routine according to the table below.
|The execution of an instruction faults||4||Create a Fault Routine for a Program||15-2|
|Communication with an I/O module fails||3||Create a Routine for the Controller Fault Handler||15-3|
|Watchdog time for a task expires||6|
|While a project is downloading to the controller, the key switch is placed in RUN||8|
|A motion axis faults||11|
|The controller powers up in run/remote run mode||1||Create a Routine for the Power-Up Handler||15-4|
You can access the full list from the link below.
Let's develop logic to manage specific fault conditions.
And now let's examine the logic of working with examples.
Create a Fault Routine for a Program
Create a new routine by right-clicking Main Program under the main task in Studio 5000.
Right-click Main Program to enter the properties menu.
Select the Fault Routine you created from the Fault tab in the Configuration section from the properties menu and click the Apply button.
To clear a major fault that occurs during the execution of your project, complete these actions in the appropriate routine.
The error routine can be used for the following operations.
• Create a Data Type to Store Fault Information
• Get the Fault Type and Code
• Check for a Specific Fault
• Clear the Fault
Create a Data Type to Store Error Information
Logix5000 controllers store system information in objects. Unlike PLC-5 or SLC 500 controllers, there is no status file.
To access system information, you use the instruction Get System Value (gsv) or Set System Value (SSV).
|MajorFaultRecord||DINT||Records major faults for this program|
|GSV SSV||Specify the program name to determine which PROGRAM object you want. (Or specify THIS to access the PROGRAM object for the program that contains the GSV or SSV instruction.)|
Specify the program name to determine which PROGRAM object you want. (Or specify THIS to access the PROGRAM object for the program that contains the GSV or SSV instruction.)
Get the Fault Type and Code
Create a UDT as follows by reviewing the user-defined data type article. Just set the last tag style to Hex. Set the others to Decimal.
Create the destination tag address in UDT type, and assign the first member of this tag.
With this command, we can catch the fault type and code when plc has a fault.
The continuation of the article is in the link below.