Fanuc Robot Zones Work With $MCH_ANG and Reference Positions

Daniel Price12 min read
FanucRoboticsTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

A PLC that needs robot position from a Fanuc controller has four options, and only one of them returns live data without extra licences or a motion command: $SCR_GRP[1].$MCH_ANG with $SCR_GRP[1].$M_POS_ENB set TRUE. The rest of this reference follows the same data path outward: PLC to controller I/O, UOP handshakes, background logic, system variables, and the motion instructions that decide whether the robot survives a fast test run.

Which zone method fits: reference positions, Space Check, DCS, or your own program?

The controller offers four ways to answer "is the robot inside this region?". They differ in licensing, geometry, and what they can drive.

Method Licence Geometry Output Constraint
Reference positions Standard feature Not a cube. One recorded point with joint-angle tolerances; opening the tolerances gives larger zones of varying shape Configured output bit Hard to visualize. A move that only passes through the window needs a FINE endpoint or a widened window to trigger reliably
Space Check Paid option True zone function (what you expect from a zone) Zone status Requires the option installed
DCS Paid option Zones intended for safety Can set a bit on or off without triggering any stop function Requires the option; safety-oriented configuration overhead
Custom program None Whatever you code Whatever you code Uses $MCH_POS, LPOS, or JPOS; each has update and frame caveats (next section)

Recommendation. If the PLC needs position for its own zone logic or HMI, use the custom-program path with $SCR_GRP[1].$MCH_ANG: it is live, needs no option, and is faster than JPOS when you only want one joint. Use Space Check when cubic Cartesian zones are required and the option is already fitted. Keep reference positions for a small number of discrete "at home / clear of fixture" bits. Use DCS only when the zone has a safety function or you already own it; using it only to flip a bit adds configuration cost without a functional gain over the other three.

Which position variable returns live data to the PLC?

The path is: pulse coders to controller position data to a system variable or a PR, then over whichever I/O rack the PLC connects to (see the rack table below), then PLC scaling. The first hop is where data goes stale, so pick the source variable by update behavior.

Source Frame Update behavior Caveat
$SCR_GRP[1].$MCH_ANG[n] Joint angle, axis n Live. Functional replacement for JPOS Requires $SCR_GRP[1].$M_POS_ENB = TRUE
World coordinates only Not live. Updates only at a move command while a program executes (auto or manual execution) Stale after a manual jog
LPOS Current UF and UT Read at execution Set UF to 0 immediately before reading if you want world coordinates. If the preceding move is CNT, LPOS triggers before that move completes
JPOS Joint Read at execution Same CNT-early-trigger behavior applies

Use the system variables when LPOS and JPOS fault out on a given controller because of a configuration issue; they are the working alternative.

  1. Set $SCR_GRP[1].$M_POS_ENB to TRUE. If the variable is read-only in normal operation, change it during Controlled Start.
  2. Map $SCR_GRP[1].$MCH_ANG[1] through the axis number you need (replace 1) to the PLC-facing register or output.
  3. For Cartesian data, read (world). Refresh them after a manual jog by loading JPOS or all $SCR_GRP[1].$MCH_ANG angles into a PR, then executing a move to that PR. The move has zero motion because it targets the current position, and the $MCH_POS values update to current.
  4. Scale and interpret in the PLC: $MCH_ANG is per axis, $MCH_POS is world only.

Verify by jogging one axis in T1 and watching the PLC value follow $MCH_ANG[n] while stays frozen until the zero-motion refresh move runs.

How does background logic pause on a DI, save the point, and resume?

A background logic program scanning at 8 ms captures the pause position with LPOS, uses UOP inputs to abort the running program, and restarts production. The main program branches on a flag register to decide between retracting and running the process from the saved point.

BACKGROUND LOGIC  DI_CAPTURE  POSITION_ABORT  (scan 8 ms)
WHEN DI[1]=(1),
  UI[2: HOLD]=PULSE,0.2sec          ; hold program via UOP
  PR[1]=LPOS                        ; current Cartesian point to PR[1]
  R[1]=1                            ; flag: program was paused
  UI[4: CSTOPI]=PULSE,0.2sec        ; abort program via UOP
  UI[5: RESET]=PULSE,0.2sec         ; fault reset via UOP
  WAIT 1.0sec
  UI[18: PRODUCTION START]=PULSE,0.2sec

PROGRAM MAIN_MOTION
LBL[1: START]
  IF R[1]=1 JMP LBL[2]              ; last run aborted
  IF R[1]=0 JMP LBL[3]              ; last run not aborted
LBL[2: RETRACT TO HOME AND WAIT]
  L P[1: POUNCE] 250mm/s CNT50
  R[1]=0
  L P[2: HOME] 250mm/s FINE
  WAIT DI[2]
  JMP LBL[1]
LBL[3: RUN PROCESS]
  L P[1: POUNCE] 250mm/s CNT50
  L PR[1: PROC_START] 250mm/s FINE   ; PR saved at pause
  L P[2: PROC_END] 100mm/s FINE
  L P[1: POUNCE] 250mm/s CNT50
  L P[3: HOME] 250mm/s CNT50

Design checks before commissioning:

  • Confirm the polarity of the HOLD input in the UOP signal definitions on your controller; the pulse in the listing is what the logic writes, so the input's active level must match.
  • The flag register R[1] is cleared only in LBL[2]. A normal cycle that never aborts must still find a valid point in PR[1] for the process-start move.
  • The CNT-early caveat applies to the LPOS capture: if the robot is on a CNT move when DI[1] fires, the saved point can be ahead of the actual pause position.

What is the UOP sequence to stop a running program and load a new job from the PLC?

The PLC drives four handshakes across the fieldbus-mapped UOP inputs. The timings below come from a working sequence.

Step Signal Action Result
1 UI[8] Enable Set OFF Running program stops
2 UI[4] CSTOPI Pulse 200 ms Main program is reset to its first line
3 PLC Send the new job selection Job data loaded
4 UI Start Pulse 150 ms Program restarts when UI Start goes low (falling edge)
  1. Drop Enable and confirm the program state changes to stopped on the pendant or the mapped status output.
  2. Pulse CSTOPI for 200 ms and confirm the program pointer is on line 1.
  3. Write the new job number, then re-assert Enable. A start with Enable OFF is not accepted by UOP, so restore it before step 4.
  4. Pulse Start for 150 ms and confirm the program starts on the falling edge, not on the rising edge.

Confirm the UI Start point number in your UOP configuration, since the sequence above names it only by function.

Which rack number addresses which I/O path?

Rack numbers select the physical or logical path when you configure I/O. The table lists every rack in the reference set.

Rack Path
0 Process I/O boards (also memory image)
16 Allen-Bradley or Genius I/O
32 Slave SLC2 I/O
33 Internal relay / register
34 Flag marker
35 Always on/off port: Slot 0 = OFF, Slot 1 = ON
36 DCS port
48 Address-mapped I/O for LR Mate peripheral connectors
64 ME-NET
65 INTERBUS-S
66 / 67 PROFIBUS DP master / slave
68 / 69 FL-net / FL-net status
70 / 71 InterBus-S master / slave
72 / 73 IO-LINK II master / slave
74 / 75 FIPIO master / slave
81 First DeviceNet board
82, 83, 84 Used by DeviceNet
85, 86 ControlNet (85 also used as 86); 86 used by ControlNet
87 RoboWeld
88 Ethernet Global Data (GE-EGD I/O)
89 EtherNet/IP (ControlNet over Ethernet) I/O
90 Arclink rack number
91 WTC serial weld controller I/O
92 CC-Link
93 / 94 / 95 InterBus PxC PCI master / slave / cmd
96 Modbus TCP
97 TOYOPUC PC3J interface
98 InterBus PxC slave interface
99 / 100 PROFINET I/O controller / device
101 / 102 Dual-channel PROFINET I/O controller / device (V9)
106 EtherCAT

Rack 35 is the handy one: map a signal to slot 1 for a constant ON, slot 0 for a constant OFF, for example to satisfy an unused permissive.

Which system variables speed up jogging and program runs, and when are they writable?

Many controller variables are undocumented or read-only. Those that change performance are writable at least during Controlled Start, and some in normal start. The speed and brake variables below are writable only while the SFSPD signal is OFF (change them in Controlled Start, or set SFSPD off).

Variable Effect
$Group[1].$USEMAXACCEL Enables the fast-acceleration feature
$Group[1].$MAX_SPEED Not described in the manual
$MCR_GRP[1].$fjog_enb Fast jogging mode enable
$GENOV_ENB = TRUE Speed override enabled
$SCR.$RUNOVLIM Global program speed limit in T1 non-step mode (and, per source, likely full auto). A TP program override above this value is overridden by it
$SCR.$JOGLIM Percentage of system maximum speed for jogging; maximum 250 mm/s (T1 step and non-step)
$SCR.$JOGOVLIM Global override for non-step T1 speed. Setting 100 can cause an occasional fault because speed reaches over 250 mm/s
$SCR.$COLDOVRD Default speed override applied at reboot
$MCR_GRP[1].$PRGOVERRIDE Programmable scaling factor on override. Default 100 = 100 % (full speed); lowering it slows programs even with General Override at 100 %
$PARAM_GROUP[1].$SV_OFF_TIME Brake-activation timeout after jogging with deadman held; default 20 seconds
$SCR.$SFJOGOVLIM Safety jog speed limit
$SCR.$SFRUNOVLIM Program run override limit (in T1, raise it to allow 100 % manual run)
$DMAURST = TRUE Auto deadman reset: the pendant resets faults and enables servos as soon as the deadman is pressed in T1

Restore every one of these to its original value before the robot goes into service. Raised jog and run limits cut development time but make a crash much easier for average users.

Which status variables can the PLC or HMI read, and how is the safety word decoded?

Variable Content
$MCR.$GENOVERRIDE Changes with the +% and -% pendant keys
$ALM_IF.ENABLE = TRUE Enables $ALM_IF.LAST_ALM and $ALM_IF.LAST_UALM
$CR_AUTO_DO Integer in the configured DO range; that DO indicates Auto mode
$CR_T1_DO Integer in the configured DO range; that DO indicates Teach mode
$SHELL_WRK.$curr_line Current line value
$MOR.$safety_stat Bit-coded safety status (table below)
Value Flag Value Flag
1 MFS_EMGOP 128 MFS_PPABN
2 MFS_EMGTP 256 MFS_BELTBREAK
4 MFS_DEADMAN 512 MFS_ENABLE
8 MFS_FENCE 1024 MFS_FALM
16 MFS_ROT    
32 MFS_HBK    
64 MFS_EMGEX    

Decode by bitwise AND. A word of 516 is 512 + 4, so MFS_ENABLE and MFS_DEADMAN are both set.

How do I clear a pulse-coder position mismatch after an image restore?

The alarm fires when the position data stored in the CPU does not match the pulse-coder data. Full mastering is not always required, although restoring an image that carries different mastering data can make it necessary. Read the alarm ID on the pendant before acting.

  1. Jog the robot to the zero position.
  2. Check the witness marks on every axis. If they are misaligned, stop here and master the robot; the stored data is wrong.
  3. If the marks are aligned, run RES_PCA to reset the pulse-coder alarm.
  4. Cycle power.
  5. Set $DMR_GRP[1].$MASTER_DONE = TRUE.
  6. Calibrate.

Verify by jogging each axis to its witness marks again and checking that the displayed joint angles read zero within tolerance.

How do I extract payload inertia from a CAD model?

The controller needs the centre of gravity and moments of inertia about the centre of gravity, expressed in the faceplate coordinate system.

  1. In SolidWorks, define a coordinate system that matches the robot faceplate frame.
  2. Output the COG and the moments of inertia about the COG in that coordinate system. Only the principal-axis values are needed.
  3. Convert units: SolidWorks reports g·mm2; the controller wants kg·m2. Since 1 g = 10-3 kg and 1 mm2 = 10-6 m2, multiply g·mm2 by 10-9.
  4. Enter the values in the payload setup.

For a hand calculation, the payload section of the HandlingTool manual describes the method.

Why do linear moves fault on posture changes, and how does CNT change the path?

A joint move compares every joint to its speed limit and sets each joint to the fastest speed that still lets all joints arrive together, so short-travel axes move slowly and long-travel axes run at their limit. A linear move checks only the commanded TCP speed against the TCP linear limit, then calculates the joint speeds needed to hold that TCP speed. It does not check those joint speeds against the joint limits. A short Cartesian distance with a large posture change demands a very short arrival time, so the axes are driven to their maximum and beyond, and the result is an E-stop or fault.

Situation Mechanism Action
Large posture change over short distance, linear Joint speeds unchecked against limits Split the posture change across multiple points
Air cuts between work points No need for a straight TCP path Use joint moves; reserve linear for approach, retreat, and action points
New program, unknown behavior Problem moves are not obvious from the teach points Test at low speed and raise it in steps
Welding Constant travel speed matters Complete the weld in one move using an external axis (turntable) moving the part under the tip, avoiding accel/decel across multiple FINE moves
CNT 100 Rounds the corner as close to the point as possible while keeping 100 % of speed Air cuts
CNT 50 Cuts the corner less, passes nearer the commanded position at 50 % of speed Intermediate points
CNT 0 vs FINE Should behave the same in theory; test results suggest they do not Use FINE for exact positioning
Reference position that triggers an output A CNT pass may miss the window Make the trigger point FINE, or widen the window to cover a wide drive-by

CNT paths change with speed. A path tuned tight to an obstacle at low speed takes a different corner path when the speed is raised, and that change has been enough to punch a servo off a robot. Re-check clearances at production speed after any speed increase.

FAQ

No. update only at a move command while a program executes. Load JPOS or all $SCR_GRP[1].$MCH_ANG angles into a PR and move to that PR (zero motion) to refresh them.

Does CNT 100 stop at the taught point?

No. CNT 100 rounds the corner as close to the point as possible while holding 100 % speed and does not stop at it. Use FINE for any point that must trigger a reference-position output, or widen the reference window.

Can I set $SCR.$JOGOVLIM to 100 for faster T1 jogging?

Yes, with SFSPD off or in Controlled Start, but jog speed can then exceed 250 mm/s and cause occasional faults. Restore the original value before service, then jog at the raised limit in T1 non-step mode and confirm no fault occurs before releasing the robot.

Back to blog