Reading Machine State

Read the control's own registers — work offsets and live position — into your own variables.

System variables are the same idea as #100, except the control owns the box. #5221 is the G54 X origin. #5041 is where X is right now. Reading them is how a macro finds out where it is.

Read firstFanuc System VariablesComplete Fanuc CNC system variable reference with read/write flags: macro arguments, tool offsets, work offsets, live positions, skip/probe results, modal codes, timers, and alarms — plus worked read/write examples.

Your turn

Copy the G54 X origin into #110, the G54 Y origin into #111, and the current X position in work coordinates into #112.

The machine gives you

a part set on the left of the table:#5221 = -450#5222 = -375#5041 = 12.5
the same program, a different setup:#5221 = -120.5#5222 = -60#5041 = -3

Your program is run once for each set of conditions. It has to work for all of them.

Loading...

This is a learning simulation — always prove out a program on the actual control before you cut metal.