TECHNICAL NOTEMOTION APPLICATION ENGINEERING GROUPYaskawa Electric America - 2121 Norman Drive South – Waukegan IL 60085(800) YASKAWA - Fax (847) 887-728011/23/2005 37 of 37 eng/05.055/MCDGearingCreating a gear application mainly consists of scaling the incoming master pulses with a B/A ratioand sending the result to the slave’s commanded position register. In the MP its possible toperform these calculations in ladder on a scan by scan basis. In this mode, the calculation isperformed every scan, by taking the differential pulses of the master encoder (called ScanDifference), applying the formula below, and generating a scaled slave position output. Thepower of the MP platform allows adjustments to be made at each step of the calculation at therate of the program scan, thereby allowing the user to change the ratio on the fly. The resultingscaled segments are accumulated in a register that is fed to the slave commanded position.When scaling the master position segments, often the result is not an integer number; to avoidloosing synchronization, the remainder must be stored and added on the next scan.Therefore, the calculation done each scan should be:Scaled Slave Position Segment = Scan Difference * B + Modulus of the Last ScanAThe Process in steps:1. Calculate the master position difference from the last scan and store the currentposition.Notice the use of SUBX and ADDX for proper calculation through the rollover point of a32 bit register. These instructions perform “two’s complement math,” which results in thecorrect answer even as one value crosses the rollover point. No math errors aregenerated.