Faults

A fault means the runtime met something it could not safely do, such as dividing by zero, and stopped. FORGE then refuses Run and Single Scan until you reset it. A fault is different from a build error, which the editor finds before the PLC runs.

Where a fault shows

PlaceWhat you see
The runtime bannerA red banner reads Faulted, the fault in words and a Reset button.
Run and Single ScanThey are refused with the message Faulted. Reset.
ProblemsThe fault is a row marked as a fault. The Faults filter lists only faults.
TroubleshootThe Last scan card shows Fault and its code, with a Go to button that opens the instruction at fault.
ReplayThe Faults tab lists faults with the scan each happened in. See Replay.

Common causes

FaultCauseWhat happens and what to do
Divided by zeroA DIV, a MODULO or a Structured Text division has a divisor of 0.Nothing is written. Guard it with a compare so the divisor is above 0.
Square root of a negative numberA square root instruction or function got a value below 0.Nothing is written. Check the sign of the value first.
Result outside its type's rangeA math result is too large or small for the destination tag's type.Nothing is written. Use a wider type, such as DINT or REAL.
Loop past its limitA Structured Text loop ran more times than one scan allows.The routine stops for that scan. Make the loop shorter, or spread the work over scans.
Statement limitA Structured Text routine ran more statements than one scan allows.The routine stops for that scan. Split the work into smaller routines.
A PID loop setting it refusesAction is not 0 or 1, Out min is above Out max, or Update ms is 0 or less.Nothing is written until the setting is fixed.

An example: a divide by zero

This rung shares a Total over a Count. Count is 0, so DIV cannot give a result. The runtime faults, and Average keeps its old value of 7 because nothing was written. The rung and tag values below are what Core produced after the scan:

TagValue
Total100
Count0
Average7

A Structured Text division by zero reads Line 4 divided by zero, so nothing was written. The reason a fault stops the run is that a wrong number written to an output could drive a machine the wrong way, so the runtime does not write one.

Clear a fault

  1. Read the fault in Problems, or in the banner. Note the routine and the instruction.
  2. Click Reset in the banner, or press Alt+Shift+R.
  3. Fix the cause. In the example, make Count at least 1 before the DIV runs.
  4. Click Run or Single Scan again. If the cause is still there, the fault comes back on the first scan.

Good to know

  • Reset clears the fault. It does not fix the logic, so a cause that is still there faults again.
  • Record the run with Replay when a fault happens only now and then. The Faults tab shows the scan it first appeared in.
  • Warnings and build errors are not faults. See The Problems and Troubleshoot panels.

Related