# Thread: work offset change alarm

1. ## work offset change alarm

I wrote this program to prevent operators from changing the work offset by mor than + or - .50 but for some reason it will not work quite right lets assume that my G55X was -21.1 I would put -21.05 in #609 and -21.15 in #609 it should alarm out if the operator changes the X G55 more than
.05 in in the plus or minus or is my logic flawed
%
O9025(M205 CHECK G55 WORK OFFSET)
(#609=ORIGNAL WPC X PLUS .05)
(#610=ORIGNAL WPC X MINUS .05)
(#611=ORIGNAL WPC Y PLUS .05)
(#612=ORIGNAL WPC Y MINUS .05)
(#613=ORIGNAL WPC Z PLUS .05)
(#614=ORIGNAL WPC Z MINUS .05)
(#5241=G55 X OFFSET)
(#5242=G55 Y OFFSET)
(#5243=G55 Z OFFSET)
(#100,#101,#102,#103,#104,#105 ARE USED FOR MATH ONLY)
#100=#5241+.05
#101=#5241-.05
#102=#5242+.05
#103=#5242-.05
#104=#5243+.05
#105=#5243-.05
IF[#100GT#609]GOTO1000
IF[#101LT#610]GOTO1001
IF[#102GT#611]GOTO2000
IF[#103LT#612]GOTO2001
IF[#104GT#613]GOTO3000
IF[#105LT#614]GOTO3001
GOTO4003
N1000
#3000=1(G55 X WPC TO SMALL)
N1001
#3000=2(G55 X WPC TO BIG)
N2000
#3000=1(G55 Y WPC TO SMALL)
N2001
#3000=2(G55 Y WPC TO BIG)
N3000
#3000=1(G55 Z WPC TO SMALL)
N3001
#3000=2(G55 Z WPC TO BIG)
N4003(G55 X,Y,Z ALL ARE WITH IN + OR - .05)
M99
%
Thanks for the help have a good turkey day

2. #5241 is the current value after change.
#609 is the maximum permitted value.
So, you have to check if #5241 is greater than #609.
Hence, do not use #100 etc. Replace #100 by #5241 in the conditional statement. Make similar changes elsewhere.

3. Logic isn't flawed... all statements are working ... just not the way you want...

I don't see where you've set #609-#614. Are you doing this in the main program? or by hand? However, assuming that you have "hard number" into them...

Flip your "LT" and "GT" in the #100 sets.... you're looking in the wrong direction...

But, you +/- another .050 of the set value to check against a +/- .050 by your 'default'. Kind of convoluted....

This might be easier to follow eh?....
Make 609-614 the actual nominal value ... no range. so you'd only need 609, 610, 611.
Then, just check the operator condition like this:

#100=ABS[#609]-ABS[#5241]
IF[ABS[#100]GT.05]GOTO1000
#101=ABS[#610]-ABS[#5242]
IF[ABS[#101]GT.05]GOTO2000
#102=ABS[#611]-ABS[#5243]
IF[ABS[#102]GT.05]GOTO3000
GOTO4003

OR just back to back checking of each direction...

IF[#5241GT#609]GOTO1000
IF[#5241LT#610]GOTO1001

ETC, ETC..

4. And, make sure that you insert G65/M98 P9025 in the beginning of each program.

5. ## Work Offsets Change Alarm

Thank You for your help I used what Psychomill posted and it work just as I wanted

Sinha I am using a M code to call the 9025 program from the main program