How to Calculate the Gear Offset Parameter?

When calculating the GEAR OFFSET PARAMETER P12296, P12552, etc. There are four values that need to be known. There is the source count or source value, the GEAR PPU, the GEAR RATIO and the PPU for the AXIS. The equation to calculate the GEAR OFFSET PARAMETER is shown below.

(Source Count)/ GEAR PPU = Value1
Value1 * GEAR RATIO = Value2
Value2 * PPU AXIS = GEAR OFFSET PARAMETER

Attached a sample code utilizing the ratch feature:

PROGRAM
PBOOT

REM ATTACH MASTER AND SLAVES
ATTACH MASTER 0
ATTACH SLAVE0 AXIS0 "X"
ATTACH AXIS0 STEPPER0 STEPPER0
ATTACH SLAVE1 AXIS1 "Y"

REM CLEAR ALL KILL ALL MOTION REQUEST
REM IN ADDITION, CLEAR ALL STOP MOVE REQUEST
CLR 8467 CLR 522 CLR 523 SET 5647
CLR 8499

REM DISABLE ALL DRIVES
DRIVE OFF X Y
DWL 0.2

REM ISSUE AN ENCODER RES FOR AXIS 0 AND 1
RES X Y
DWL 0.2

REM SET GEAR OFFSET PARAMETER TO ZERO
P12296 = 0
P12552 = 0

REM SETTING THE PPU OF EACH AXIS
PPU X 25000
PPU Y 4000

REM SETTING THE MOTION PROFILE FOR EACH AXIS
ACC 100
DEC 100
VEL 30
STP 100

REM ENABLE DRIVES USED
DRIVE ON X Y

REM SETTING THE GEAR SOURCE AND MODE OF OPERATION
GEAR SRC X RATCH0 Y RATCH1
RATCH0 SRC P6272
REM IN MODE 3, NORMAL FOR POSITIVE PULSES
REM AND BUFFER NEGATIVE PULSES
RATCH0 MODE 3
RATCH1 SRC P6272
RATCH1 MODE 3

REM SETTING THE GEAR PPU OF EACH AXIS
GEAR PPU X4000 Y4000
REM SETTING THE GEAR RATIO OF EACH AXIS
GEAR RATIO X5 Y-2.5
REM ENABLE RATCH FOR AXIS
GEAR ON X Y

ENDP

With the sample code above, the required values for calculating the GEAR OFFSET PARAMETER are

Source count or source value = P6272
GEAR PPU X = 4000, Y = 4000
GEAR RATIO X = 5 , Y = -2.5
PPU AXIS X = 25000, Y = 4000

Sample Calculation for P12296:

With P6272 = 4168
Value1 = 1.042
Value2 = 5.21
GEAR OFFSET PARAMETER = 130250

Sample Calculation for P12552:

With P6272 = 4168
Value1 = 1.042
Value2 = -2.605
GEAR OFFSET PARAMETER = -10420