Teach pendant programming
Setting Up an Interrupt Program
Configure a FANUC condition monitor so the controller watches an input, register, or alarm in the background and calls an action program the instant the condition is met. You build a Cond-subtype condition program with a WHEN rule, bracket the watch region with MONITOR and MONITOR END, and write an action program that carries no motion group. Done well it reacts to urgent events without you polling for them in the main path.
- Step 1.
Understand what a FANUC interrupt program actually is
On this controller the interrupt mechanism is the Condition Monitor Function. It accepts input/output signals, registers, and alarms as conditions, and the controller itself watches them, calling a program the moment a condition is satisfied. The feature is built from four parts: a MONITOR start instruction, a MONITOR END stop instruction, a condition program, and an action program.
- Step 2.
Choose a program monitor or a system monitor
A program monitor starts and stops from MONITOR / MONITOR END instructions inside a running program, and it ends when that program ends, so it suits watching a condition only during a specific routine. A system monitor is started and stopped from a dedicated screen and watches constantly regardless of any program's run state. The two types can be used at the same time.
- Step 3.
Create the condition program with subtype Cond
On the program list screen press F2 CREATE and enter a name for the condition program. Press F2 DETAIL to reach the program details screen, move the cursor to the subtype item, press F4 CHOICE, and select Cond. A Cond program automatically takes operation group [*,*,*,*,*,*,*,*], because a condition program needs no motion group.
- Step 4.
Write the WHEN rule inside the condition program
A condition program holds condition instructions only, in the form WHEN <conditional-expression>, CALL <program-name>. For example, WHEN RI[2]=Off, CALL STP_RBT calls STP_RBT when robot input 2 turns off. You can compare registers and system variables against a constant or R[i], compare analog and group I/O (AI, AO, GI, GO), or test digital I/O (DI, DO, RI, RO, SI, SO, UI, UO) for ON or OFF.
- Step 5.
Use edge detection when you want the change, not the level
For a digital signal you can specify Rising Edge or Falling Edge instead of a steady ON/OFF. A rising-edge condition is satisfied only when the signal goes from off to on, and a falling-edge condition only when it goes from on to off; a signal that merely stays on or off never satisfies an edge condition. Edge detection avoids a level condition re-firing every scan while the signal sits in one state.
- Step 6.
Combine conditions with AND or OR, but not both on one line
One WHEN line can join up to five conditions with AND (logical product) or with OR (logical sum). Mixing AND and OR on the same line is prohibited: if you change one operator, the controller rewrites the rest to match and warns that the operator was replaced. Keep each line to a single operator type for readable, editable logic.
- Step 7.
Trigger on an alarm using an error-number condition
A condition can compare against an error number formed as aabbb, where aa is the alarm ID and bbb is the alarm number. For SRVO-006 Hand broken the servo alarm ID is 11, so the error number is 11006, and WHEN can call an action program when that alarm appears. Use this to notify or log a fault, and always route the fault itself to correct-the-cause-first handling rather than clearing it automatically.
- Step 8.
Write the action program with no motion group
The action program is called when the condition is satisfied and can use the same instructions as a normal program, but its operation group must be [*,*,*,*,*,*,*,*]. A typical body sets a notification output such as RO[2]=ON, increments a counter like R[8]=R[8]+1, and raises a user alarm with UALM[1], whose message text comes from $UALRM_MSG[1]. Keeping it group-less prevents an unintended commanded move from firing mid-cycle.
- Step 9.
Bracket the watch region with MONITOR and MONITOR END
In the program that should do the watching, add MONITOR <condition-program-name> where monitoring should begin and MONITOR END <condition-program-name> where it should stop. Everything between the two instructions is the region where the controller evaluates that condition. Program end, forced end, or an alarm also deletes the program monitor until a MONITOR instruction runs again.
- Step 10.
Set the program-monitor behavior for a temporary stop
System variable $TPP_MON.$LOCAL_MT selects how a program monitor behaves when the program pauses: values 1 or 3 stop monitoring on a temporary stop (setting 1, the default), values 2 or 4 keep monitoring (setting 2). Its default is 3, and under 3 or 4 an action program that carries a motion group raises an alarm, which is why the action program must use [*,*,*,*,*,*,*,*]. Change $TPP_MON variables from the system-variable menu under controlled start, then cold start.
- Step 11.
Enable and arm a system monitor if you need constant watching
A system monitor is off by default ($TPP_MON.$GLOBAL_MT=0); set it to 1 or 2 under controlled start to enable it, where setting 2 keeps its state across a cold start. Open the system monitor screen, put the cursor on the condition program, and press F3 START to begin watching. Because it ignores program run state, a system monitor is suited to a plant-wide safety-adjacent notification rather than a step-specific check.
- Step 12.
Watch monitor status on the program and system screens
The program monitor screen lists each condition program, its status (Running or Paused), and the parent program that started it, with F3 RESTART, F4 PAUSE, and F5 END to control a highlighted monitor. F2 SYSTEM switches to the system monitor screen but does nothing while the system monitor is disabled. On the system monitor screen, F3 START and F5 END arm and stop a condition, and a blank status means it is not started.
- Step 13.
Test at reduced speed with the robot region clear
Run the watching program with a low speed override and force the trigger, confirming the action program runs and any commanded outputs behave. Verify the main program resumes on the path you expect, since an interrupt can change robot state mid-cycle. Keep clear of the work envelope during the first live trigger and only raise speed once behavior is proven.
- Step 14.
What can go wrong: the condition re-fires the instant you re-arm it
After a condition is satisfied the condition program goes to the END state; to keep watching you must issue MONITOR again, and you must clear the condition first. If the action program re-issues MONITOR while the condition is still true (for example it sets R[1]=0 but the input is still on), the condition is satisfied immediately on the re-arm and the controller raises an error. Drop the condition inside the action program before the MONITOR line.
Caution: Clear the triggering signal or register before re-arming, or the monitor will loop on itself and fault.
- Step 15.
What can go wrong: a second monitor overwrites the first
If two MONITOR start instructions name the same condition program, the first is overwritten by the second rather than both running. Up to ten conditions can be monitored at once and up to five AND or OR operators can sit in one condition line, so give each concurrent watch its own condition program name. Multiple WHEN lines in one condition program start multiple monitors together.
- Step 16.
What can go wrong: you cannot edit or run the condition program
A condition program cannot be edited while its program is executing or stopped, and it cannot be executed directly on its own. If you need to change the WHEN logic, end the monitor and the parent program first, then edit. Treat the condition program as configuration that is locked whenever a watch is live.
- Step 17.
Document the trigger, action, and resume behavior
Add comments naming the exact signal, register, or error number that fires, the action program it calls, and whether monitoring re-arms afterward. Note the $TPP_MON setting you chose so the next technician knows the pause and power-cycle behavior. Clear documentation prevents a future edit from silently changing when the interrupt fires.
Common questions
- How long does Setting Up an Interrupt Program take?
- Setting Up an Interrupt Program is rated Advanced and takes about 45 minutes across 17 steps.
- What tools do I need?
- You will need Teach pendant, Access to controlled start (for changing $TPP_MON monitor mode system variables).
- What should I do before starting?
- The signal, register, or alarm that should trigger the interrupt is already assigned and tested. You know whether the watch should be tied to one program (program monitor) or run system-wide (system monitor). A current backup, so you can restore if a monitor-mode system variable is set wrong.
- What is the first step?
- Understand what a FANUC interrupt program actually is. On this controller the interrupt mechanism is the Condition Monitor Function. It accepts input/output signals, registers, and alarms as conditions, and the controller itself watches them, calling a program the moment a condition is satisfied. The feature is built from four parts: a MONITOR start instruction, a MONITOR END stop instruction, a condition program, and an action program.