Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Captcha Click on image to update the captcha .


Register Now

register content

PLC Controller Fault Routine

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.

Condition:Fault type:
The execution of an instruction faults4Create a Fault Routine for a Program15-2
Communication with an I/O module fails3Create a Routine for the Controller Fault Handler15-3
Watchdog time for a task expires6
While a project is downloading to the controller, the key switch is placed in RUN8
A motion axis faults11
The controller powers up in run/remote run mode1Create a Routine for the Power-Up Handler15-4

You can access the full list from the link below.

Allen-Bradley PLC I/O Faults Causes/Solutions

 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.

plc programming plc fault routine create plc

Right-click Main Program to enter the properties menu.

plc programming MainTaskPro plc

Select the Fault Routine you created from the Fault tab in the Configuration section from the properties menu and click the Apply button.

plc programming SelectFaultRoutine plc

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).

Attribute:Data Type:InstructionDescription
MajorFaultRecord DINT[11]Records major faults for this program
GSV SSVSpecify 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.)

Create your own custom UDT data types with user-defined data types.

User Defined Datatype UDT Usage Examples in RSLogix 5000 PLC

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.

plc programming Fault UDT plc

Create the destination tag address in UDT type, and assign the first member of this tag.

plc programming FirstMajorrecord plcWith 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.

Create Controller Fault Routine