View Full Version : G code & M code (noob questions sorry)

08-07-2012, 10:48 AM
Hi everyone,
Sorry but more noob questions.
I have searched but I havent found any the answers.
I know they are there somewhere but there is A LOT of information on this forum.

My questions are what is the difference between g code & m code & are they used together in the same macro?
I have searched for these codes but havent found a complete listing anywhere & a lot contradict each other. Is there anywhere I can get a concise, complete listing?
Can anyone recommend the best way or program to learn how to use the codes to their full extent.

Thanks again for you patience,


08-07-2012, 10:57 AM
G codes are standard motion control code (servo motion), but there is a slight variation according to the type of machine, e.g. Machining centre, Punch, Plasma,EDM etc.
The M codes are decided and written by the MTB, again there is some standardization, but this all depends on the personal writing the code.
M,S,T codes are passed over to what is generally known as the Machine controller/PLC/PMC as part of the MTB/OEM design.
The reason for two processes is so that the motion controller is not bogged down servicing the relatively slow machine codes and functions.
For example when you buy a Mitsubishi or Fanuc system, all the control for the G code is built in for that particular package, Lathe, Mill etc, but the PLC is blank, and the MTB is required to write the M.S.T. routines for these.
Some text books such as Computer Numerical Control Programming by Michael Save and Joseph Pusztai have a typical listing of G and M code for various types of machines
Al .

08-07-2012, 11:42 AM
Thanks for the reply Al,
Now I have a starting point.

08-07-2012, 11:48 AM
Have you seen this Wikipedia page? G-code - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/G-code)

It has a fairly good listing of all the codes used in CNC.

08-07-2012, 01:26 PM
Nice one Geof, that one has helped me several times. http://www.cncezpro.com/cnc.cfm will help as well.

08-08-2012, 07:30 AM
Thanks again for the info everyone. Seems I have some reading ahead of me