User guide
Chapter 6. Following
203
FSHFD Example
In this example, the slave follows a master that moves in a continuous cycle. Once each
cycle, the master and slave both pick parts. The master's part is detected by a sensor connector
to trigger B, and the slave's part is detected by a sensor connected to trigger A. After both
parts are detected, they must be aligned. The sensors are mounted 2 inches apart from each
other, so that proper alignment would result in 2 inches of slave travel between detection of
the master's part and detection of the slave's part.
The slave position is sampled when each of the sensors activates. The difference between the
slave positions is compared to the required 2 inches. If the measured difference is greater than
or less than 2 inches, then a shift move to correct the alignment is made. At that point, the
slave will then start tracking the master again. The slave (axis #1) is continually following
the master at a 1:1 ratio.
DEL ALIGN ; Delete program before defining
DEF ALIGN ; Begin definition of program called ALIGN
COMEXC1 ; Allow continuous command execution during motion
INFEN1 ; Enable input functions
FOLMAS31 ; Axis 3 Encoder input is the master for slave axis 1
FOLRN1 ; Set slave-to-master ratio numerator to 1
FOLRD1 ; Set slave-to-master ratio denominator to 1
; (ratio set to 1:1)
FOLEN1 ; Enable Following mode on axis #1
MC1 ; Enable continuous positioning mode
D+ ; Set direction to positive
GO1 ; Start Following master continually
INFNC25-H ; Enable trigger input A to latch position of slave
; when the slave's part is detected
INFNC26-H ; Enable trigger input B to latch position of slave
; when the master's part is detected
$SYNCLP ; Main loop where synchronizing moves occur
WAIT(SS.25=b1
AND SS.26=b1) ; Wait for both slave and master inputs to occur
This line is for steppers only →
VAR10=1PMCA ; Load VAR10 with the slave motor position due to
; slave input activation
This line is for steppers only →
VAR11=1PMCB ; Load VAR11 with the slave motor position due to
; master input activation
This line is for servos only →
VAR10=1PCCA ; Load VAR10 with the slave commanded position due
; to slave input activation
This line is for servos only →
VAR11=1PCCB ; Load VAR11 with the slave commanded position due
; to master input activation
VAR12=VAR10-VAR11 ; Load VAR12 with the offset distance
VAR13=VAR12-2 ; Calculate the required shift
FSHFD(VAR13) ; Perform synchronization move of distance in VAR13
JUMP SYNCLP ; Return (jump) to main program loop
END ; End of program
Summary of Ratio Following Commands
FOLEN ........................ Enables or disables Following mode
FOLMAS....................... Defines masters for slave axes
FOLMD ........................ Defines the master distance over which slave acceleration or moves
are to take place
FOLRN and FOLRD.......... Establishes the maximum slave-to-master ratio for a preset move or
the final ratio for a continuous move (FOLRN for the numerator and
FOLRD for the denominator)
FSHFD ........................ Initiates preset advance or retard (shift) of slave position during
continuous Following moves
FSHFC ........................ Initiates continuous advance or retard (shift) of slave position (or kills
or stops the shift portion of motion) during continuous Following moves
SCLD .......................... Sets the slave distance scale factor
SCLMAS....................... Sets the master distance scale factor
TPSHF
or [ PSHF ] ....... Transfers or assigns the net position shift since constant ratio
TPSLV
or [ PSLV ] ....... Transfers or assigns the current slave position
TVMAS
or [ VMAS ] ....... Transfers or assigns the velocity of the master axis










