Can someone take a look at this that knows macros.. Having a hell of a time getting this to check to see if my probe is off. Basically it uses a M code relay that will turn it on or off. I want it to turn it off and make sure its off (#1029 skip) before continuing. It will try 4 times before throwing an error. With this code it will finish without error even if it turns the probe back on. It appears as if I cannot use a IF statement to read a changing variable. It outputs what the value was when the start button is pressed.
Code:
%
O09833 (REN MP700 OFF)
G103 P1 (LOOK AHEAD ONE BLOCK)
#3001= 0
G04 P250
G04 P1
G04 P1
G04 P1
G04 P1
G04 P1
G04 P1
IF [ #3001 LT 200 ] GOTO999
N2
#4= 0
N3
M63 (RESET M RELAY)
G04 P200
#4= #4 + 1 (TRY TURN OFF 4 TIMES)
IF [ #4 EQ 4 ] GOTO4
M63 (RESET M RELAY)
G04 P200
M53 (M CODE TO SWITCH OFF PROBE)
#3001= 0 (RESET MS TIMER)
WH [ #1029 NE 1 ] DO1 (WAIT FOR MP700 OFF)
IF [ #3001 GT 3000. ] GOTO3 (MP700 FAIL TO TURN OFF AFTER 3 SEC TRY AGAIN)
END1
GOTO999
N4
#3000= 101 (TURN OFF PROBE FAILURE)
N999
G103 (DISABLE LOOK AHEAD)
M99 (RETURN)
%