Hi, I have been a long time reader of the forum but this is my first post. I am currently running a Hardinge 2 axis lathe with a Fanuc Series Oi-TD Control. I am trying to set up a bar puller and have the following lines of code run at the end of my program to stop the machine when it reaches the end of the bar (I will eventually move this statement above the puller code to save on the last piece of material):
#102 = 10 (Number of parts desired)
#101 = #101+1 (increment counter)
IF[#101GT#102] THEN M30
M99
%
When the IF statement evaluates as false the program works perfectly and calls the M99 (skipping over the M30) but as soon as the part count is reached and [#101GT#102] evaluates as true, the control throws the following error rather than calling the M30: PS0127 DUPLICATE NC, MACRO STATEMENT
I assume this is a simple syntax error and any advise I could get would be greatly appreciated. I have tried a good number of different syntax variations from different examples I have found and tried replacing the M30 with something such as a tool change (to see if it was the M30 was causing the problem) but the same error is thrown.I do have macros enabled on the control and can watch #101 increment up after each part in the Macro Offsets Page. Currently the program is still functional because the error effectively acts as an M30, stopping the program, but would still like to improve it and lean how to use IF statements properly for other applications I have in the future. Thanks
#102 = 10 (Number of parts desired)
#101 = #101+1 (increment counter)
IF[#101GT#102] THEN M30
M99
%
When the IF statement evaluates as false the program works perfectly and calls the M99 (skipping over the M30) but as soon as the part count is reached and [#101GT#102] evaluates as true, the control throws the following error rather than calling the M30: PS0127 DUPLICATE NC, MACRO STATEMENT
I assume this is a simple syntax error and any advise I could get would be greatly appreciated. I have tried a good number of different syntax variations from different examples I have found and tried replacing the M30 with something such as a tool change (to see if it was the M30 was causing the problem) but the same error is thrown.I do have macros enabled on the control and can watch #101 increment up after each part in the Macro Offsets Page. Currently the program is still functional because the error effectively acts as an M30, stopping the program, but would still like to improve it and lean how to use IF statements properly for other applications I have in the future. Thanks