Fanuc Subprogram (Local Subroutine)

Fanuc Subprogram (Local Subroutine)

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

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 little 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. At least you can make a meal of the 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.

Haas To The Rescue

Of course Mr Haas sorted this out years ago with M97, this calls a local sub. M98 calls an external program. It’s on all Haas machines and you definitely do need to fuck with any parameters.

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

 

 

 

 


Background Edit Fanuc

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Background edit, I only really get to hear about background edit when people get stuck in it. It’s a bit like being accidentally locked in a toilet you feel a bit of a twat and very embarrassed in equal measures.

This button is your closest friend

Now I made it real big because one day it will save your life.

You know when you play Monopoly and you get one of those cards that says “GET OUT OF JAIL FREE”

If you get sent to jail you just present this card and your sentence is immediately quashed it’s a bit like having Donald Trump as a mate.

It doesn’t work for shop lifting by the way I tried it as a child when I nicked a tin of Spam from the Coop. Fortunately in those days the police were never involved as they knew your parents would beat you to within an inch of your life at the slightest hint of petty larceny.

Anyway press this button background edit all your woes will cease.

And if that doesn’t work this one is the nuclear option.

background edit

The first one is for the program you’re actually background editing. Don’t forget you can have more than one program that you are background editing, more on this later.

Anyway this button stops them all, a clean sheet as it were.

Oh Dear

The reason people get into such a mess with this is because you can actually get into background editing by accident it’s easy.

If you are in a folder and you press INPUT then whatever program your cursor is on immediately comes up for background editing.

If you do this a few times then you can have several programs on the screen to edit.

 

You can switch between these programs and edit any one. You can copy and paste between them which makes writing programs from templates really easy.

Use the FORWARD and BACKWARD softkeys to switch between programs

To escape this lot you need the help of this key

background edit

This will end it all.

Background Edit is Amazing

Yes background edit is really useful, maybe amazing is stretching it a bit, but it does have many uses. Editing a few programs together is the bit I like.

If you want to edit whilst you are running a program then that’s also useful.

Background edit Warning

Don’t hit the fuckin reset button!!!!

Obviously this will stop everything so why would you do it?

Well maybe you are one of those very naughty boys who uses it to get to the head of the program when editing.

When in background edit it’s easy to press reset except this time you just stopped everything because your program is running.

Change Your Habits

Use rewind, some controls have a rewind button

use this to get to the head of the program.

On other controls it’s LINE SEARCH then press TOP or BOTTOM

This will take you directly to the head of your program or the end of your program.

Nothing is stopped and no one is harmed.

background edit

 

Why I Hate Background Edit

It’s an absolute pain in the bollocks mainly because it is so easy to accidentally get into background edit and not even realise.

You keep pressing the MDI button and the screen just wont change. If you have Guide i then you will get a warning when you switch over and you can’t do anything until you end it.

To be honest I don’t hate it at all. You just need to be aware that you need to come out of it to do various other things.

Another Useful Feature

If you want to use a program for reference. In other words you want to look at what’s in it but you need to be careful not to alter it.

Press BG EDIT then type in your program number

Press REF EXEC

Your program will appear in green meaning it is “read only” so you can’t accidentally alter it.

What’s Running in The Background?

You can also call your running program in background edit. This will also appear in green and be read only.

 

 


Ten Things You Might Not Know About The Fanuc Sub Program

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Sub Program Fanuc

Here are ten things you might not know about Fanuc sub programs,

Fanuc CNC controls are the most common controls in the world so it might be useful to have a good understanding of how sub programs are called and used.

(1) You Can Call a Sub Program By Name.

Yes you heard it here the program can be called by it’s name or it’s number. When calling by name don’t use the P.

Just put the name of the program in these things <> with an M98 and your away.

M98<ALBERT>

The only problem with this is that the syntax needs to be spot on so if you have got complicated names for your your sub routines then you might be in the shit.

I always call mine names like ALBERT that are easy to remember.

(2) You can use internal sub routines on a Fanuc Control.

Some people call these local sub programs. It just means it’s tagged on the end of your program which makes them nice n easy to look after. A bit like a pet Goldfish or a pet fly.

I bought mine from the local pet store. I asked the assistant if he sold pet flies and he said no. I said “well there are loads in the window”.

Anyway he sold me one (£15) his name is Paul

 

This is not him this is Steve.

Internal Sub-Routines

By typing M98 Q500 your control will look for N500 within your current program. This is great because you can add the sub programs to the end of your main program. Don’t forget to leave big gaps so you can clearly see where and what they are. Oh and mind your P’s and Q’s.

M98 P500 (Call O500 externally)

M98Q500 (Call N500 in main program.

Oh and read this too.

Sub Program

Just one other thing. Watch your n numbers it’s easy to get them mixed up. Try and use a convention.

“Read More”

Fanuc Editing Copy and Paste

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Fanuc Editing Oi Model D. This does vary on the age of your control this article is for a newer control (Fanuc Oi Model D).

Read this article if you want to see Fanuc Editing 18i (older control) or this one for older Oi control  copy and paste.

Now I’ll warn you that it’s not a simple process but if you get into the habit of using it you’ll never leave home without it.

I am definitely not going to rant on and on about why all these simple procedures were not introduced years and years ago. Why has the editing on CNC controls generally been so shit over the years?

I am also not going to rant and and whinge about how fuckin complicated it all is.

I mean bloody hell all I want is to take this shit here and join it to the end of this shit here.

I’m not asking  for an “X Factor Audition Here” (Simon if you are reading this my contact details are above) I only write this crap to try and make some money, my really passion is singing and exotic dancing in my underwear. I really want this Simon, just one chance is all I need.

“Read More”

Careers in CNC

View all current vacancies in CNC

Click here

Call David: 07834 858 407