The above diagram shows (In the most basic of terms) how the system works. The CNC itself is what does the work, but the CNC gets it’s instruction from the G cote interpreter. In most cases this is written directly on bare metal, as opposed to a piece of software that needs to be loaded.
This part of the control takes the g code, interprets it, and moves the servos to cut the part. It also does everything else. What is everything else? i’m glad you asked. Though, very soon, you won’t be.
Everything else consists of things like
Tool changes, and all the associated motion and real world interface (Actuators, switches, encoders)
Safety equipment (Doors, estops, etc)
Fixturing (Clamps, chucks, tailstocks, pallet changers, barfeeders, etc)
So: The control is busy. The actual code is only a small part of what the cnc needs to do, because all the rest of it has to be 100% deterministic, in other words, has to happen in real time. When you hit Estop, you don’t want the control to tell you “OK< I'll be right there, I have to finish this line first and then I'll stop" Above the interpreter is the G code. You can write G code directly into the machine, or you can use a CAM system of some kind or another to write G code for you. This is commonly done in cases where the code is so complex that it would take forever to write. So why not compile the code, SiG asks? Well to completely understand this, you have to understand the times that a handwritten or CAM created code is error free out of the gate: 0. Tool paths are a thing, but tools are too. I have been working with the very best NC programmers in the industry for thirty years, and I can tell you, they are constantly tweaking code, refining it, changing it to be better. Simple example:On a machine with an really slow tool change, say, four or five seconds, you center drill all the holes first, then change tools once, and then do all the drilling, then maybe tap or ream or whatever. On a machine with a fast toolchanger, say a half or a quarter of a second chip to chip, you center drill, drill, ream, tap, whatever, without moving, because it is faster to stay directly over the hole and just go to the next needed tool. And it is completely common to take a cutting program off one machine and put it on another, if that machine can be made to process the part faster. The technology of the machines changes very regularly as well, and it is possible and common that the machine is altered to suit some new purpose- accessories are added like drill/reamer combinations, high pressure coolant that allows much faster drilling cycles, fixtures that hold the part more firmly so deeper cuts can be made. If the programs were compiled they would have to be modified and recompiled every time a change was made. And that happens with astounding frequency in every shop in North America. Even on old, established processes. Additionally, it requires about an eighth grade math competency to learn and comprehend G code, and make minor changes on the fly. Again, in the early days, compiled code was a thing, but it was found to be so cumbersome and so impractical that it fell out of use very quickly. Landfills are full of controls that were designed to work like that. There are still places where compiled code is used in Robotics, but they are very few and far between and are only used for very specific purposes. More on that eventually. First we have to talk about N dimensional geometers.