M145 (# Set watching for GANTRY Sensors) G91 G0 Y-1000 F500 (# Move toward Gantry Sensors) ( There is message delivery time from PLC to CNC control software) ( Need to wait some time till registers #800-802 will be updated ) ( Add 0.5 seconds pause to get all the registers refreshed ) G4 P0.5 (# Pause) G10 L81 P809 Q800 (Get offset in pulses) G10 L193 P809 Q5531 (Calculate offset in units/mm) G10 L81 P810 Q809 (Copy Offset in units/mm to #810) G10 L190 P810 Q805 (Add tuning offset) M211 P0 (# OFF the second motor, the Only first motor is ON ) G10 L190 P810 Q5022 (# Add current machine position) G28.9 Y810 (# Move 1 motor to adjust) M211 P1 (# ON the second motor, both motors are moved together)