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.
Programme would look like this.
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.
And then your Subprogram is like this.
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
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