History of G-Code
The above video is part of my G-Code tutorials that I recorded with Practical Machinist. More can be found here
In the beginning..
Image from Wolfgang Hunscher, Dortmund, CC BY-SA 3.0, via Wikimedia Commons
Between 1942 and 1945 the first programming language was invented by a German engineer called Konrad Zuse and was named Plankalkül.
Before then, it is generally regarded that Ada Lovelace’s “Algorithm for the Analytical Engine” was the first EVER programming language way back in 1883, but this was before the PC was invented and is not classed as a high-level language.
A high-level language means that it is readable by humans, where a low level language is machine code that consists of 0's and 1's that is interpreted by our CPU's.
Mr Zuse Plankalkül went mostly unnoticed by western countries at the time due to the second world war.
The birth of G-Code
In 1957, John Backus invented Fortran.
This is possibly the oldest programming language that is still used today, it was designed to do statistical and mathematical calculations.
This is important because it was only one year later that the first version of G-Code (referred to as RS-274) was invented, in 1958.
This makes G-Code one of the first programming languages that we still use today, and its use is still growing year after year, especially now that 3D printers as well as CNC machines both use G-Code.
G-Code, the early years
As we can see from this graphic, G-Code was invented around the same time as other early high-level programming languages.
The current standard G-Code version is RS-274D (ISO 6983).
When a tooling manufacture produces a new machine, this is the standard they use when building the controls. They use this as a base and add custom features to it as needed. For example, the new machine might have more types of coolant delivery systems than supported by RS-274D so they add more M-codes to control the extra systems.
When we learn to program G-Code, we are usually taught the standard or generic version. Throughout our careers, as we program different machine controls we come across these custom features but they are easy to understand as we already have a solid understanding of G-Code.
This is why it is always recommended to familiarise ourselves with the new machine by using the operators manual to see what might be added to the standard G-Code that we are already familiar with.
Because of the subtle differences between all the versions of G-Code currently being used on our machines, CAD/CAM software outputs the G-Code files using a post-processor that matches the machine the code is destined to run on.
Which came first? CNC or G-Code?
When G-Code was first conceived at MIT, its intended use was for 2 axis plotters. This is far from the 12 axis machining centres that runs on G-Code today. Over the years as our needs grew, so did the capacity of our favourite language to be able to control more complex machines.
This includes my favourite part of G-Code, Macro programming.
Modern G-Code has changed a lot since the early days, now with macro programming, we can utilise variables, if/then logical statements and more. With the use of variables, G-Code becomes more like a traditional programming language with being able to save outputs from maths and equations and recalling them at any part of the program for use.
variables can only hold numeric values currently, so strings and arrays are still not possible in macro programming, but having the ability to store numbers in variables makes G-Code a fun language to learn as it expands on an already solid language to give us the option to write our own custom cycles and greatly speed up coding by hand. Often it is quicker for a skilled machine tools programmer to write a program in G-Code by hand than it is to build a model and construct tooling paths within a CAD/CAM package. especially for basic parts and lathe work.
Even though G-Code is over 60 years old, it is still growing and updating to match our needs. This means G-Code is still relevant and knowledge of programming G-Code is a very useful skill to have in the machine shop.
Share this article
To learn the basics of G Code programming, check out my Foundation course
The quickest way to learn CNC Programming