What's new
What's new

Trouble getting this code to run all the way through on lathe

nightsky84

Aluminum
Joined
Nov 26, 2019
I am running a Hyundai Kia SKT21 lathe with a Fanuc Oi-TC controller.
Everytime it gets to the M05 code in tool T0909 it stops and the spindle keeps spinning and it eventually alarms out with an AL15 Error something about it timing out I don't remember. The thing is the M05 code should stop the spindle it works up until this point. I have another program that is almost identical to this one that works just fine all the way through so I'm confused to why this one will not read the M05 code. Any suggestions? I have tried to just leave out the code for it to stop and let it run through the last 2 tools and then let it start over but it stops on the G50 code for the first tool when it gets to it. I have tried M2 instead of M5 and no luck there either. If I run just those 2 tools it works fine so I think it has to do with something beforehand, but I can't figure out what! Any help would be greatly appreciated!!
%
O0002
G00G20G40G97G99
/G00G28U0.
/G00G28W0.
/T0808
/G00Z.015
/G00X0.0
/M00
/G00Z1.0
G00G28U0.
G00G28W0.
T1111
G50S3500
G96S625M03
M08
G00Z0
G00X.600
G01X-0.025F0.006
G00Z.1X.36
G01X.5Z-.05F.006
G00X.625
M05
M09
G00G28U0.
G00G28W0.
T0505
G97S1500M03
M08
G00Z.5
G00X0.
G01Z0.050F0.050
G01Z-.55F0.005
G00Z1.0
M05
M09
G00G28U0.
G00G28W0.
T0606
G97S1500M03
M08
G00Z.5
G00X0.
G01Z0.050F0.050
G01Z-.115F0.005
G00Z1.0
M05
M09
G00G28U0.
G00G28W0.
T0404
M66
G97S300M03
M08
G00Z.5
G00X0.
G84G99X0.Z-.5F.05R.5
G80
M05
M09
G00G28U0.
G00G28W0.
T0303
G00Z.5
G00X0.0
G98
G01Z-.45F25.
M69
G01W1.5F50.
M68
G00Z3.
G00G28U0.
G00G28W0.
G00G20G40G97G99
T0909
G50S3500
G96S620M04
M08
G00Z.12
G00X.6
G01X.5F0.012
G01X.43Z.06
G00X1.
M05
M09
G00G28U0.
G00G28W0.
T0101
G50S3500
G96S430M04
M08
G00Z.13
G00X.650
G01X0.525F0.010
G01X0.250F.003
G01X0.200
G01X-0.025F.002
G00X5.0
M05
M09
G00G28U0.
G00G28W0.
/M30
M12
M99
%
 
It looks like the previous operations are spinning the spindle clockwise with M03, but on the operation you're having problems with, it's going reverse with M04. Could that have something to do with it?

I'd try starting the spindle with M03S3500 in MDI, and then commanding an M05. Watch how it stops. Then do the same test using M04S3500 instead. See if it stops ok or if it has problems coming to a complete stop. It could be that your spindle belts need tightening and for whatever reason, it can stop ok in M03 but not M04.
 
I can run the operations separately and they both run find M03 or M04...this spindle is actually only 4 months old so everything is basically brand new on it. All other programs that have an M03 or M04 mixed into the program run fine. It's just this one I'm having trouble with.
 
Just a wild guess, but G96 S650 at 1.00 dia that chuck is probably really spinning.
Try going to a larger X to slow the spindle down. Maybe the brake is weak and can't stop the spindle in the pre set time, so it times out.
 
Single block through the program try to verify that the M5 is your issue.
Throw a M3 with rpm etc at it in mdi....then mdi an m5.
My initial thought is m5 is not the issue
 
Just a wild guess, but G96 S650 at 1.00 dia that chuck is probably really spinning.
Try going to a larger X to slow the spindle down. Maybe the brake is weak and can't stop the spindle in the pre set time, so it times out.

Tried this and it didn't work still the same issue.
 
Single block through the program try to verify that the M5 is your issue.
Throw a M3 with rpm etc at it in mdi....then mdi an m5.
My initial thought is m5 is not the issue

I did this earlier today and it still stopped at the M5 although I also believe that is not the issue. I think something before it is causing it to not work, but I'm not sure what. My other program is set up the same way and it runs through just fine. So when this does happen and it stops at the M5 I press reset on the machine and the spindle still spins. It will not stop unless I press jog. If I go to mdi and put the m3 in and then m5 it will stop so It works fine. There's just something missing or too much in the code that is causing it not to work.
 
Maybe this line G00G20G40G97G99 I didn't see it on the tool change before
This was manually put in. If you don't put this in the machine loses its offset and it causes the tools to go super slow instead of at regular speed. It's only normally needed after I use T0303 which is my pull stock tool.
 
Have you tried deleting the M05 on that line to make sure it is the issue? If it is, the program should run fine after, if not it should stop at G00X1.
 
This was manually put in. If you don't put this in the machine loses its offset and it causes the tools to go super slow instead of at regular speed. It's only normally needed after I use T0303 which is my pull stock tool.
Hello nightsky84,
The only component of the G00 G20 G40 G97 G99 Block that is required after the Tool 3 in your program is G99. You used G98 (Feed Per Minute) for your Bar Pull because the spindle is not running. When you revert to running the spindle and specify a feed rate in terms of Feed Per Rev, F0.012 in the operation following the bar pull, the axes will feed at the slow rate of F0.012 per minute if G98 is still current.

There is nothing in that block that would prevent the loss of the tool's offset and nothing in that program area that would cause the loss of tool offsets. T0909 in the following Tool Operation would call the Geometry and Wear Offset for tool number 9.

G20 selects the Unit System to use, Metric or Imperial. In the case of G20, the Imperial Unit System will be invoked. G20 should be specified in a Block at the start of the program and its poor practice to specify it again in the program. Once specified, it remains model even when the power to the control is cycled.

Regards,

Bill
 
Hello nightsky84,
The only component of the G00 G20 G40 G97 G99 Block that is required after the Tool 3 in your program is G99. You used G98 (Feed Per Minute) for your Bar Pull because the spindle is not running. When you revert to running the spindle and specify a feed rate in terms of Feed Per Rev, F0.012 in the operation following the bar pull, the axes will feed at the slow rate of F0.012 per minute if G98 is still current.

There is nothing in that block that would prevent the loss of the tool's offset and nothing in that program area that would cause the loss of tool offsets. T0909 in the following Tool Operation would call the Geometry and Wear Offset for tool number 9.

G20 selects the Unit System to use, Metric or Imperial. In the case of G20, the Imperial Unit System will be invoked. G20 should be specified in a Block at the start of the program and its poor practice to specify it again in the program. Once specified, it remains model even when the power to the control is cycled.

Regards,

Bill

Thanks for that. I did remove everything except the G99 and it runs fine, but still have the M05 issue where it gets hung up at.
 
Have you tried deleting the M05 on that line to make sure it is the issue? If it is, the program should run fine after, if not it should stop at G00X1.

Yes I have. I have single blocked it until it hits the M05 and it stops. I have deleted both the M05's after T0303 and it runs fine until it gets back to the beginning of the program then it stops at the G50 S3500 near the beginning of the program. I'm not convinced the M05 is the issue though I believe there is something prior to that that is making it not read it correctly. Just can't seem to figure out what.
 
So further testing I erased the T0303 completely out of the program and it still does it. Soooo is there something wrong in the tapping part of the program?
 
Seems like you have M4 invoked when you loop back, right? Then when the loop runs a 2nd time, you try to do this:

G50S3500
G96S625M03

Is that not asking the spindle to go directly from reverse 3500 to forward 625?

Ida Know, maybe there is a cancel somewhere in the loop start or end codes that erases the M4, but if not, I think the above might be at least part of the problem. Doesn't explain why it keeps running code afterward, to the M5 where you actually do get the error message.

Regards.

Mike

That's why the M05's need to be in there so it stops the spindle before it gets back to the beginning of the program. Also I have ran just the last 2 tools without the M5's and it ran fine even when it hit the M04 then the M03.
 
That's why the M05's need to be in there so it stops the spindle before it gets back to the beginning of the program. Also I have ran just the last 2 tools without the M5's and it ran fine even when it hit the M04 then the M03.

Yes, I see now that my theory is flawed. Something else then :scratchchin:
 








 
Back
Top