Fanuc Subprogram (Local Subroutine)

Fanuc Subprogram (Local Subroutine)

Category : Fanuc

Fanuc Subprogram (Local Subroutine)

If you have ever used local subroutines on Heidenhain or Yasnac. Then you will know how convenient it is to save all your programs in one go. No need to remember to save all those shitty external sub programs.

What’s He On About?

If you are now saying “what the fuck is he on about”. Here is an explanation.

A local subroutine or subprogram is where you stuff all your subprograms at the end of your main program.

So on a Fanuc control if you were making this part below.

Drill spot drill then tap.

Fanuc Subprogram

Programme would look like this.

Fanuc Subprogram

 

Thing is the code is just repeated three times. I have nice round numbers in here like X40. and Y20. so it’s easy to notice mistakes. But if it was X40.392 for example you wouldn’t spot a slight mistake.

So if you call a subprogram it looks like this.

Fanuc Subprogram

And then your Subprogram is like this.

Fanuc Subprogram

Fanuc Subprogram

The M98 P500 calls the external Fanuc Subprogram. Read this if you don’t know about sub programmes.

Saves you having to repeatedly write shit loads of code.

So that’s why we use a Fanuc Subprogram. But……

You have to look after these bloody things and they seem to be able to just get lost on their own.

You find them at the back of the fridge sometimes along with a piece of mouldy old cheese.

Fanuc Subprogram No More Lost Programs

So this is how it looks with a Local Subroutine.

All you need to do is replace P with Q. So mind your P’s and Q’s as they say.

The Q corresponds to any N number. So you could have loads of these stacked up at the end of your programme and you only need to save it once. All this shit will go with it and you don’t need to worry about it ever again.

Just A word Of Caution.

There are PARAMETERS involved. Arrrrrrrrrrrh……..the dreaded PARAMETERS

To call a subroutine on your Fanuc control. You first need to make sure that Bit 0 of parameter 06005 is set to 1

Fanuc Subprogram

This should make it work. If it doesn’t then maybe you should call the Samaritans.

It’s only on the newer controls by the way.

Sub programs on a Siemens control.

Thanks For Reading My Articles We Love you all .

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

If you want to learn to program CNC Milling Machines

 

 

 

 


4 Comments

Jeff Long

April 7, 2021 at 9:22 pm

Thank you very much for this information. I figured there had to be a way. Its just such a nice feature to have. You get used to using it on the Haas. Would have been great to have that 30 years ago on the fanucs.

    David

    April 8, 2021 at 9:40 am

    It’s not on all Fanuc controls but if it’s there then why not use it. Thanks for your comment.

Andres

April 11, 2021 at 6:24 pm

Hi,
One question, Is possible use both sub program call (M98 with P and M98 with Q)?

    David

    April 21, 2021 at 4:35 pm

    Yes

Log out of this account

Leave a Reply

WP to LinkedIn Auto Publish Powered By : XYZScripts.com