Z Marker Failure

Z Marker Failure

Want a timout if the DATUM command fails to find the sensor or the Z.

We don't have anything built in to the DATUM command itself. You could make 2 separate DATUM commands, one for the swtich and then one for the Z. Add a timeout to each one.

DATUM(3)
TICKS = 10000 ' 10 seconds
REPEAT
     WA(1)
UNTIL IDLE OR TICKS<0
IF NOT IDLE THEN
     CANCEL
     home_error = 1
ENDIF
WAIT IDLE

IF home_error = 0 THEN
     DATUM(2)
     TICKS = 2000 ' 2 seconds
     REPEAT
          WA(1)
     UNTIL IDLE OR TICKS<0
     IF NOT IDLE THEN
          CANCEL
          home_error = 2
     ENDIF
ENDIF

The second one could be done as a position check, say 1.1 turns of the motor, instead of a timeout. The first datum will set the axis to 0 at the switch, so the MPOS should not go more than one turn before it sees the Z.

Or write your own datum function that includes timeout or position checks.