'-------------- Device Params ----------------------- Params End Params '-------------- Define (dim) Global Variables -------- Dim count as integer '-------------- Main Program ------------------------- Main While 1 = 1 If DIN2.STATE = 1 Then 'start homing IL.LIMITN = -0.1 'lower current limits so it doesn't cause mechanical damage IL.LIMITP = 0.1 MOVE.ACC = 1000 MOVE.DEC = 1000 MOVE.RUNSPEED = 50 MOVE.GOVEL While PL.ERR < 90 : Wend 'wait for position error to increase DRV.OPMODE = 1 'switch to velocity mode so drive doesn't fault MOVE.POSCOMMAND = 0 'set position to zero DRV.OPMODE = 2 'back to position mode IL.LIMITN = -3 'reset current limits IL.LIMITP = 3 Pause (3) End If While DIN1.STATE = 1 'make some position moves For count = 1 To 5 Move.Acc = 10000' Acceleration (drive units) Move.Dec = 10000' Deceleration (drive units) Move.RunSpeed = 500' Runspeed (drive units) Move.RelativeDist = 360' Distance to move (drive units) Move.GoRel Pause (1) Next Move.Acc = 1000' Acceleration (drive units) Move.Dec = 1000' Deceleration (drive units) Move.RunSpeed = 1000' Runspeed (drive units) Move.TargetPos = 0' Target position (drive units) Move.GoAbs Wend Wend End Main '-------------- Subroutines and Functions ------------ '-------------- Interrupt Routines -------------------