What's new
What's new

G52 used in a loop Fanuc 16

meowkat

Aluminum
Joined
Aug 18, 2013
Location
IL USA
I think I have a syntax error trying to loop a program. It is turning and milling on a 5" diameter bar, it doesn't pull the bar so I want to get 3 or 5 parts parted off per program run. Hoping to use G52 to update the work offset by computing the stepover per iteration.
Fanuc 16TB, program goes something like this:

Code:
:1005 (BACKPLATE TURRET1 PROG)
G0 G20 G40 G80 G96 G99
#1 = 0.0 (loop count)
#2 = 3.0 (Max iterations)
#3 = 0.262 (stepover CONST)
WHILE[#2 GT #1] DO1
#1 = #1 + 1

.
.
.

G52 Z - #3*#1 (Z zero update) <--- likely problem syntax
END1
G52 Z0.0
M5
M9

G0 G28 U0.
G0 G28 W0.
M46 (C AXIS JOINT RELEASE)
G54

M30

Error message was 004 variable/reference not found or something similar to that.
 
Until someone experienced in Macro programming shows up, how about a little from a purely math perspective?

Maybe add some [Brackets] or (Parenthesis) perhaps? Better clarify what statements go with what.

To me the line is too wide open for interpretation certainty. (If that's a phrase.) But what do I know! :-)
 
I would like to use parentheses to ensure the calculation (#3*#1) is performed before the function (G52) is called with an argument, but they indicate a comment in Gcode as far as I know.

edit, I was also assuming the order of operations would dictate the multiplication would be resolved before the G52 call.
 
I think I have a syntax error trying to loop a program. It is turning and milling on a 5" diameter bar, it doesn't pull the bar so I want to get 3 or 5 parts parted off per program run. Hoping to use G52 to update the work offset by computing the stepover per iteration.
Fanuc 16TB, program goes something like this:

Code:
:1005 (BACKPLATE TURRET1 PROG)
G0 G20 G40 G80 G96 G99
#1 = 0.0 (loop count)
#2 = 3.0 (Max iterations)
#3 = 0.262 (stepover CONST)
WHILE[#2 GT #1] DO1
#1 = #1 + 1

.
.
.

G52 Z - #3*#1 (Z zero update) <--- likely problem syntax
END1
G52 Z0.0
M5
M9

G0 G28 U0.
G0 G28 W0.
M46 (C AXIS JOINT RELEASE)
G54

M30

Error message was 004 variable/reference not found or something similar to that.


Hello meowkat,

Your current following Block

G52 Z - #3*#1

needs to be written as follows

G52 Z-[#3*#1]

However, its better practice to express the DOC ((step-over CONST) with direction (+ or -). Accordingly, had:

#3 = 0.262

been expressed as

#3 = -0.262

then the G52 Block would be written as follows:

G52 Z[#3*#1]

Regards,

Bill
 
Try using common variables instead of system variables:
#501
#502
#503
Always use brackets, not parenthesis. Parenthesis are for comments.
And, why not use G54/55/56 instead of G52?
 
Try using common variables instead of system variables:
#501
#502
#503
Always use brackets, not parenthesis. Parenthesis are for comments.
And, why not use G54/55/56 instead of G52?


I have only figured out you can change the G54 Z zero with some parameter address and it caused some problems when I first tried it.
I think this G52 solution is exactly what I was looking for. This job will run basically unattended now for hours.
 








 
Back
Top