PROGRAM 'Program 0 'TODO: edit your program here ' Set the hardware limit deceleration to be very high. hldec X 1000 set bDisableDriveOnKill while(BIT bDriveMotionProgram) 'Wait for the flag to be set that tells us we're ready to move while (NOT BIT bActuatorMove) wend ' Now make sure that the E-Stop is clear if (BIT bEStopClear and BIT bProgTwoRunning) 'Turn on the drive and turn off the jog profile drive on X dwl 0.2 jog off X ' Set up the jog profile and reset the counter jog vel X 40 jog acc X 20 jog dec X 40 jog jrk X 40 jog ren X if (BIT bOpenCmd) ' If we're trying to open, drive that way first until we hit the limit. if (BIT bEStopClear and BIT bActuatorMove and BIT bProgTwoRunning) clr bKillAllMovesZero clr bKillAxisZero jog rev X inh - bAxisZeroJogActive endif ' Now, for repeatability, drive back out 5mm if (BIT bEStopClear and BIT bActuatorMove and BIT bProgTwoRunning) jog vel X 5 clr bKillAllMovesZero clr bKillAxisZero jog inc X 5 inh - bAxisZeroJogActive endif else ' We're trying to close, so drive slowly that direction until we hit the limit if (BIT bEStopClear and BIT bActuatorMove and BIT bProgTwoRunning) clr bKillAllMovesZero clr bKillAxisZero jog fwd X inh - bAxisZeroJogActive endif ' Now, for repeatability, drive back out 5mm if (BIT bEStopClear and BIT bActuatorMove and BIT bProgTwoRunning) jog vel X 5 clr bKillAllMovesZero clr bKillAxisZero jog inc X -5 inh - bAxisZeroJogActive endif endif 'Now when we get here, we're just outside the limit. 'Drive slowly until we reach the limit. This guarantees that the limit comes on at the 'next power-up so we'll be in a well-determined location if (BIT bEStopClear and BIT bActuatorMove and BIT bPosLimitClear and BIT bNegLimitClear and BIT bProgTwoRunning) 'Set up for a slow jog move and make sure the axes are enabled jog vel X 5 jog acc X 20 jog dec X 40 jog jrk X 40 clr bKillAllMovesZero clr bKillAxisZero if (BIT bOpenCmd) ' We're trying to open, so go that way jog rev X else ' We're trying to close, so go that way jog fwd X endif 'Wait for it to finish inh - bAxisZeroJogActive endif jog res X drive off X endif clr bActuatorMove set bMoveComplete wend clr bDriveMotionProgram ENDP