How to Home to a Limit in AcroBASIC

Products: ACR9000, 9030,9040,9600,9630,9640, Aries-CE

Related FAQ: HLBIT - Assigning Limit and Home Inputs

The normal homing operation (JOG HOME) in the ACR controllers assumes the axis has two End of Travel (EOT) limits and one home sensor. For axes with only end of travel limits sensors, the following code can be used. Note that the Local Variable LV0 is used for axis number.

Note with newer firmware, JOG HOME can be used if you reassign the Home input as the EOT bit. Instead of HLBIT X0, within the program you can assign it as HLBIT X(0,1,0) See related FAQ above.

 

Bits used in this code
Jog Active BIT792
Positive EOT Limit Current State  BIT 16128
Negative EOT Limit Current State BIT16129
Positive EOT Limit Encountered BIT 16132
Negative EOT Limit Encountered BIT 16133
(Add 32 x the axis number to find the correct bits beyond axis0)

 

DIM LV1

_HomeNegativeEOT
LV0=0  : REM ASSIGN AXIS NUMBER HERE
AXIS(LV0) JOG VEL 1
AXIS(LV0) JOG ACC 10
AXIS(LV0) JOG DEC 10
AXIS(LV0) HLDEC 100
AXIS(LV0) JOG REV : REM MOVE TOWARD NEG EOT
WHILE (BIT (792+32*LV0))
    REM WAIT HERE WHILE JOG IS ACTIVE
WEND
IF (BIT(16133+32*LV0))
     REM encountered negative EOT
ELSE
    GOTO HOMEFAILED
ENDIF
CLR BIT(8467+32*LV0)
AXIS(LV0) JOG VEL 0.1
AXIS(LV0) JOG FWD
WHILE (BIT(16129+32*LV0))
WEND
AXIS(LV0) JOG OFF
INH -(792+32*LV0)
AXIS(LV0) RES  : rem reset all counter to zero
RETURN

 

_HomePositiveEOT
LV0=0  : REM ASSIGN AXIS NUMBER HERE
AXIS(LV0) JOG VEL 1
AXIS(LV0) JOG ACC 10
AXIS(LV0) JOG DEC 10
AXIS(LV0) HLDEC 100
AXIS(LV0) JOG FWD : REM MOVE TOWARD POS EOT
WHILE (BIT (792+32*LV0))
REM WAIT HERE WHILE JOG IS ACTIVE
WEND
IF (BIT(16132+32*LV0))
    REM encountered negative EOT
ELSE
    GOTO HOMEFAILED
ENDIF
CLR BIT(8467+32*LV0)
AXIS(LV0) JOG VEL 0.1
AXIS(LV0) JOG rev
WHILE (BIT(16128+32*LV0))
WEND
AXIS(LV0) JOG OFF
INH -(792+32*LV0)
AXIS(LV0) RES  : rem reset all counter to zero
RETURN

 

_HOMEFAILED
rem home operation did not reach switch, place code here to recover
REM GOSUB
END

 

 

 

jw May 2013