Category Archives: Haas Mill

CNC Sub Program

On or Offsite CNC Training
Tel: David 07834 858 407

CNC Sub Program, all CNC machines will have some form of sub programs.

 This article deals with G code (ISO) type programming but most of the features talked about will be available in some form on any CNC control. 

A CNC sub program is a branch from your main program into another program.

After completing this, your control will return to the main program and continue where it left off.

It’s like the branches of a tree.

Sub Program 

Probably the most common use of a CNC Sub Program would be for a tool change position. You could have a sub program which took the machine to a position for tool change. Your machine probably does this anyway but it’s hidden.

The advantage of this is that you could use it for any program and you don’t have to keep writing it. It is going to be very reliable because you know you never touched it. (Honest governor). 

You could use a sub-program for a set of hole positions, call it out once to spot drill and again to drill and again to tap. Just use it as many times as you want.Got to be good for the environment too.

CNC Sub Programme

 

Some controls have internal sub programs Haas and Yasnac as well as Heidenhain and Siemens have this facility.

You can do it on a certain Fanuc controls but it is an option.

It means you can stuff these at the end of your program and jump into them the same way as you would an external one. 

CNC Sub ProgrammeCNC Sub ProgrammeCNC Sub Programme

Why would I want to do that you say?

Easier to manage is the quick answer.

You know when you save your main program there are no pesky sub programs lurking that you forgot to save. They are all built into your main program.

Normally you would call your sub-program once only and you don’t need to tell it “oh I want this once” it says “come on mate I know that I’m not stupid.

But you can call it several times and if you get into incremental programming, and I hope you do, you will definitely find a need for this.

Sometimes with sub-programs it’s what you don’t put in that matters. What I mean is if your milling and you put the feed in the sub-program you are stuck with it. If it’s not there then you can state the feed externally and use a different one every time.

On Machines Like The BMC 800 from Toshiba

Tosnuc 888

This machine has the Tosnuc 888 control.

It uses G72 followed by the dollar sign, oh and for the repeat command it uses L but don’t forget the comma.

G72 $MYPROGRAM , L2

Yes Tosnuc uses anything for a program name up to eight characters. So that it doesn’t get confused by the L you have to put in a comma.

Tosnuc 888

By the way on this control (Tosnuc 888) you don’t use M99 at the end of your sub program you just use M30 and it works correctly.

Don’t try this on your Fanuc or Haas control as M30 means stop and rewind and that’s what it will do. Then it will just sit laughing at you.

Ok now you can watch the video.

CNC Milling sub programming examples.

 

If you liked this video, please don’t forget to subscribe to my YouTube channel by going to: CNC Training Centre

Please contact me if you require:

  • Fanuc training.
  • CNC programming training.
  • Want to learn CNC programming.
  • Fanuc programming training.
  • Yasnac programming training.
  • Any type of CNC course.

Services offered at CNC Training Centre

Edgecam training.

Classroom programmer training.

Onsite CNC Machine Training.

CNC Training on all controls and machines.

Mazak Training Fanuc Training

Don’t forget we offer training on all types of Mazak Machines and all Fanuc Controls 6m to 31i Oi old to young.


Modal and non modal G codes

On or Offsite CNC Training
Tel: David 07834 858 407

Modal and non modal G codes

Modal and non modal G codes

Let Me explain

We all know that programming can be complicated. So let me explain to you how it all works. This article explains the real meaning of Modal and non modal G codes.

Modal means that once a command is issued it stays in the control.

How Can you Actually Use This?

If you issue a G0 or G00 command the machine is in rapid and you do not need to re-state it.

Rapid means all motors are flat out, like a teenager in a Ferrari.

Every move from then on will be a rapid move unless you tell it otherwise. The G code that changes it must be in the same group. For example G0 G1 G2 and G3 are all in the same group a bit like The Beatles used to be.

The other day I was talking to  a “young person” who hadn’t even heard of the Beatles. I mean fuckin hell, am I really really old or are they doomed to be forgotten?

By the way my definition of a young person seems to get older every day.

Imagine being called a “young person”. You hear politicians on the telly saying “oh yes I was talking to one of those young people the other day”.

God I hate the fuckin telly, well apart from Love Island, Naked Attraction, Embarrassing Bodies, Goggle-box, Coronation Street, Emmerdale Farm, East Enders, and Strictly Come Dancing.

To be really honest I watch everything but in my defence I never stop complaining and throwing Pot Noodles at the TV.

Here’s one I made before the program

My TV’s are covered in dents and scratched from various foreign bodies being thrown at them. Obviously I have a TV in every room and toilet. They all still work even when the noodles trickle inside.

I have five, toilets not TV’s. My mother said “you must use loads of water, not to mention lavatory paper”

I said “mummy darling don’t you understand that you can’t shit or a piss in five toilets at the same fuckin time”

Obviously I didn’t say toilet in front of my mother it’s always lavatory.

Oh Yea I Was Saying I Hate The Telly

I saw this thing on the Internet 8 huge Emmerdale Spoilers .

Now I know a lot of you CNC Programmers out there are big fans of the show but I got to say it.

Spoiler I mean how in the fuck can you spoil something that’s already a mind numbing piece of crap!!

When I hear the music to that show it gets me really enthusiastic about emptying the cat trays that are heaving with piss and shit. (I know you are not supposed to leave them for over a week but in my defence I am getting into a routine now)

“Come on Dave the swearing gets worse, the Americans won’t like it”

I admit this is a rant too far and I wouldn’t blame you for going to a different website.

This guy writes serious stuff about G Codes unfortunately for you, almost every post and video is full of mistakes and often blatantly wrong.

Anyway you deserve it for not sticking with me through  difficult times.

I shouldn’t say this but there are so many mistakes in these articles I don’t know how the fuck he gets away with it. Well that’s the Internet folks.

His new series of training videos is called “Learn The Five Quickest Ways to get Instantly Dismissed as a CNC Machinist”

Modal and non modal G codes

G0 Rapid.
G1 Feed.
G2 Clockwise arc.
G3 Counter-clockwise arc

It is pretty obvious that these would have to replace one another because if you had them on the same line they would contradict one another.

You can’t go around a clockwise circle and in a straight line at the same time.

Tigers Fighting About modal G Codes

G0 X0 Y0 (Rapid to X0 Y0)
Y50.
(Control says “ok I get it, rapid again, no need to repeat yourself, I heard you the first time”)

Modal and non modal G codes. How do they actually Work?

There are not many non modal commands G53 and G4

Can’t think of anymore right now.

G4 is a dwell if this were modal it would cause many problems

G0 X50. Y50.     (Rapid move)
G4 X5.                  (Five second dwell)
X0                        (This would be a rapid command not another dwell because it remembers the G0)

It remembers the G0 but conveniently forgets the G4.

My third wife was a bit like that she said I slapped her in the face but conveniently forgot that this was only after she kicked me in the bollocks and chopped off my left ear with a potato peeler.

The machine will do the G4 dwell and then completely forget it. If you really want another dwell you’d have to repeat the G4. Otherwise it’s like being told it’s your turn to feed the dog, the command is ignored.

Yes folks you can use X or P for a dwell command. I use X cos I love the feeling when the operator comes back to me n says “Dave you got this wrong”.

First of all I ignore him because my name is David and I don’t answer to Dave.

When he finally gets through to me, I love that feeling of power and superiority when I explain to him it works with P and X.

G53 is a machine position command.

If you use a non modal command you have to repeat it for every line you want to use it on.

G53 Z0;
G53 X0 Y0;

“Wake Up State” Modal and non modal G codes.

What’s This all About?

These are the G codes that are active when you turn on the control. Wake Up State, not to be confused with getting out of bed with a steaming hangover after a night on the piss.

Modal and none modal G codes
Wake up state

This wake up state cannot be guaranteed as you can change this state by parameters.

There is also a parameter which controls what happens when you press the reset button. So for example pressing reset may cancel a canned cycle. (Or not).

Modal and non modal G codes
Worn out reset button
Your modal G codes will change when……
  1. You press reset.

  2. When you first turn on your machine (Wake Up State)

  3. You read an M30 at the end of a program.

M Codes

These are not actually called modal but the same applies once you start the spindle (M3) you do not need to write it again until you want to stop or reverse it. M4 will start the spindle in reverse CCW. M5 will stop spindle.

No need to programme M05 just M5 will do try reading this.

Speeds

Speeds are modal but your machine may wake up with a speed of zero.
So in MDI if a speed is active and you program M3 the spindle will start at the active speed (so be careful). 

If you program just a speed S2000

If the spindle is running it will change. If the spindle is not running it will change but not start. When you later start the spindle it will be at the new RPM.

When you program just a speed the machine becomes a smart arse. It laughs at you saying “Fuck off sucker, I’m not starting the spindle cos you didn’t ask me”

Wasted Code

When I first started programming CNC machines in 1905 each program had loads of information at the beginning. None of us knew what the fuck it meant and no-one dared to alter it or take any of it out.

It could only be altered after a religious ceremony and the ritual slaughter of a Gerbil when there was a full moon.

 

 

Did someone say Gerbil

You could be fired on the spot for even talking about these G Codes.

If only we had known about Modal and non modal G codes life would have been so much better.
So now I am all grown up, I say “do everything for a reason”. Consider your Modal and non modal G codes.

The program on the right has wasted code.

modal

Oh and in the early day’s we often used to turn the machine off and back on again which usually sorted most problems.

No one knew why the fuck we did this but because it seemed to work we always did it.

Women often say why do men keep putting their hands down their pants. The answer is we don’t know but we do it anyway. Well I don’t know maybe you do know why.

Coming back to turning the machine off and on again. Imagine if you didn’t have a G50 in your CNC lathe program and it was set to a very low speed in another program that you had just been running.

You could wonder why you machine was running so slow. Obviously if you turn the machine off this would reset. Everything would work fine again.

So let’s see how this works.

You may want to include this line at the beginning of your program as a standard thing.

G40 G80 G90 G21

G40 Cancel tool radius compensation.
G80 Cancel canned cycle.
G90 If you state this at the beginning of each tool then you don’t need this at the start of the program.
G21 Metric, if you never change to inches you don’t need this at program start.

Here is an article on well set out CNC Code.

Anyway if you must write a load of bollocks at the beginning of your program please learn what each G Code means and why it’s there. Oh and don’t blame me when your fingers wear out.

It’s just not good enough to say “the bloke on nights always puts that in”

And That’s Not All with Modal and non modal G codes

If you are running short on memory these are things to look at. Some CAD systems will output loads of unnecessary shit but you need to sort your post processor to stop this. It’s quite easy to fix. Loads of leading and trailing zeros to get rid of.

X0.000 same as:
X0
X050.000 same as:
X50.

Feed-rates are modal too so you only need to state them once and then again when you wish to change them. 

It is best to state all of the modal information you require at the start of each section of code. Just after the tool change is the best place.

Try to program each tool as a section, as if it were a program on it’s own.

Each tool should have all the necessary information to run on its own. Nothing should be assumed at the start of each tool. Oh and always take into account Modal and non modal G codes.

Modal and none modal G codes

But There is a Catch

Be careful when using MDI with Modal and non modal G codes as you do not know what G codes are active. All controls will have a screen displaying active G codes.

There are loads of them on this screen, don’t worry if you don’t know what they all are (even Fanuc don’t really know, they just make them up).

How Can you Actually Use This?

If for example in a section of program you have only one feed rate then that is all you will need to alter. If it’s repeated in several places (which your pesky CAD  system may do). Then you will need to remember to change each one.

I very much doubt that you enjoyed reading this article but their are loads more

Loads of articles on CNC Programming, enjoy yourself:

Checking CNC Programmes

Using a Decimal Point

CNC Programming

Zeros Not required on Haas Control

Sub-Programming

G0 Cancels Canned Cycle

Modal and non Modal

G28 Verses G53

An introduction to Macro Programming

Just an Address will do…

Turning Basics G50

Letter O number Zero

Running Order

Leading and Trailing Zeros

Jumping Sections of Program

Well Set Out Code

Thanks for reading my article.

Please contact me if you require:

  • CNC programming training.
  • Want to learn CNC programming.
  • Fanuc control training.
  • Yasnac programming training.
  • Any type of CNC course.
  • CNC lathe training
  • CNC Vertical Machining Centre training
  • If you have won the lottery and you want to give some money away.

Services offered at CNC Training Centre

Classroom programmer training.

Onsite CNC Machine Training.

CNC Programming and Training on all controls and machines.

Mazak Training Fanuc Training

Don’t forget we offer training on all types of Mazak Machines and all Fanuc Controls 6m to 31i Oi old to young.


Haas Control Zeros Not Required

Category : Haas Mill Haas Turn

Haas Control

On or Offsite CNC Training
Tel: David 07834 858 407

For Example In MDI on a Haas Control

When you type code into your Haas control there is no need to input the zeros. This applies in programme edit and in MDI.

For example in MDI

Try typing in: G90 G X Y Z
Then press ENTER
You will get: G90 G00 X0 Y0 Z0

 HOW EASY IS THAT!

Mmm…….

“Read More”

G10 Using G10 on a Fanuc Type Control

G10

I am always amazed that so many companies still don’t use G10 in their CNC programs. If you know you know.

I must admit I fuckin hate a lot of the things that young people say like “can I get a Latte”. (Get behind this fuckin counter and make it yoursef if you want to “get it”).

Anyway I kind of like “If you know you know”

No G10… Is this you?

I am sure you have your reasons which I will accept. But if your reason is that you don’t understand it then that’s just not good enough.

So you make a part, it’s all setup and you need to break it down.

If you can fix the work holding in such a way that you can reload it in exactly the same place then you need G10.

Let me explain, watch this video to see how single point location works.

G10 No need to spend loads of money.

You could just bolt a sub plate to your machine table so that vices and chucks etc can have dowels to locate them.

But the main idea is that you can relocate your work holding in exactly the same place every time.

G10
Using G10 on a Fanuc Type Control

This is your work offset page on a Fanuc control.

G10

These figures are written in by hand or by automatic setting.

If you had written this line in your program.

G90 G10 L2 P1 X-440.500 Y-265.200 Z-443.00

They would have been written in automatically when you ran the program.

So the work offset page could have any values in G54 but as soon as you run your program this G10 command will replace them with its preset values.

Make Sure Your in Absolute

Try not to forget the G90 (Absolute) because you may accidentally be in G91 (Incremental). What would then happen is it would add these numbers to what is already in the work offset. Oh dear me.

In G90 it will always replace them.

You can write to G54 G55 G56 G57 G58 or G59 just by changing the P number.

G90 G10 L2 P1 X-140.600 Y-265.923 Z-400.00 (G54)

G90 G10 L2 P2 X-125.500 Y-236.865 Z-313.865 (G55)

G90 G10 L2 P3 X-800.500 Y-563.200 Z-125.00 (G56)

G90 G10 L2 P4 X-440.500 Y-265.200 Z-169.369 (G57)

G90 G10 L2 P5 X-440.500 Y-265.200 Z-123.568 (G58)

G90 G10 L2 P6 X-410.500 Y-235.200 Z-443.00 (G59)

The code above would setup all six work offsets.

What about the L2 you ask?

What’s that for?

L2 means you are writing to the work offsets (G54- G59)

But you can also write to the tool length offsets in which case it would be

G10 L10 P1 R200. (200 length into tool 1)

G10 L12 P1 R10.(10mm radius into tool 1)

WARNING THIS IS NOT THE SAME ON ALL FANUC CONTROLS

Look David, I Have Shit Loads of Offsets

Don’t need your stupid G10.

Now I know some of us do have more offsets than you can shake a cheap memory stick at, but……..

With G10 it’s fixed in program so if some daft bastard alters your precious work offset you don’t give a flying monkey’s shit. Your program just reloads it.

Conclusion

G10 means your datum positions are saved with your CNC program.

The vice or fixture needs to be in exactly the same place when you next set it up.

You can use special single point location fixturing or just make a sub plate.

It’s great for horizontal machines.

Haas G10

 


G0 Cancels Canned Cycles

G0 Cancels Canned Cycles, this is not a news flash it’s always been the case.

G0 Cancels Canned Cycles

O0001(G28 Example)
(PROGRAMMED BY ANDY MURRAY)
G21 G90 G40

T01 M06(20MM ENDMILL)

G90 G0 G54 X200. Y0 S1500 M3
G43 Z3. H1 M8
G81 G98 Z-5. R1. F100.
X100.
X50.
G0 X25. (No hole drilled here cycle would be cancelled)
G80 (This also cancels the cycle)

“Read More”

WP to LinkedIn Auto Publish Powered By : XYZScripts.com