Major Fault State and Add-On Instructions
If a fault condition occurs that would prevent an instruction from being able to execute, the instruction is cancelled and a major fault is reported. A major fault causes logic execution to halt and the controller switches to faulted mode (the OK LED flashes red).
Depending on your application, you may not want all major faults to shut down your system. If you do not want all major faults to shut down your system, create a fault routine to clear the fault and let your application continue to execute.
Fault Recovery
The process of resuming execution after a fault is cleared is known as fault recovery.
IMPORTANT:
Do not use fault routines to continually clear all faults on the controller. Program the fault routine to be selective in the types and number of faults cleaned. It is also a good idea to log that the fault occurred so it can be analyzed later.
IMPORTANT:
When an instruction errors due to a fault, for example, a COP with an indirect addressing programming error, the instruction is skipped and not executed. This occurs with all instructions.
TIP:
In a system that uses recipe numbers as indirect addresses, an incorrectly typed number could produce a major fault.
To keep the entire system from shutting down in the event of this fault, a fault routine can be programmed to clear type 4, code 20, major faults.
Recovering From a Major Fault
If the fault is cleared, the faulted instruction does not continue executing.
Example

The logic inside an Add-On Instruction generates a fault. While the logic of an Add-On Instruction may look like a subroutine, it is not – the Add-On Instruction is an instruction. When a fault occurs inside an Add-On Instruction, the remainder of the Add-On Instruction is cancelled. If the fault is cleared, execution resumes with the MOV.
Important Points Regarding Add-On Instructions
- The Add-On Instruction stops executing at the instruction that caused the fault. This means that the remainder of the scan mode routine does not execute.
- If the fault is cleared, execution resumes at the instruction following the top-level Add-On Instruction invocation. For example, assume the above Add-On Instruction myAoi invokes a nested Add-On Instruction myNested, which invokes another nested Add-On Instruction inner. Furthermore, assume that an instruction inside of inner causes a fault. If the fault is cleared, execution resumes with the MOV (the remainder of inner does not execute; the remainder of myNested does not execute; and the remainder of myAoi does not execute.)
- During prescan:
- The Logic routine is executed (in prescan mode).
- The Prescan routine is executed (in normal scan mode).
- During postscan:
- The Logic routine is executed (in postscan mode).
- The Postscan routine is executed (in normal scan mode).
If a fault occurs while processing the Logic routine, the Add-On Instruction cancels (the remainder of the Logic routine does not execute and the pre and post scan routines do not execute). If the fault is cleared, execution resumes at the instruction following the top-level Add-On Instruction invocation.
Provide Feedback