What is CNC?
Nothing more than a simple Mill or Lathe with a computer control accompanied to control it’s working.
Conventional Machines
Conventional mill/lathe are controlled by machinists, machinists can freely control machine axis movements, can choose spindle speed of their liking, can change tool at their will (although all these steps are component material dependent, as for a harder material you have to choose a low-speed etc. but every thing is controlled by the machinist.).
CNC Machines
Now if you see the CNC machines, here not everything is in the control of CNC machinist (some might disagree). On a CNC machine every step tool-change/spindle-speed/axis-movement is controlled through CNC machine control. A CNC machinist can only Start/Stop/Control-tool-cutting etc.
Every component operation (tool-change/axis-movement/spindle-speed/gear-selection) is stored in the cnc-machine-memory as a list of Instructions this is called a Part-Program or just a Program.
Every Part-program consists of multiple instruction (which tell cnc machine what to do).
If you see the Part-program you will see multiple lines of instruction.
Every line of part-program is called a cnc program block.
Every cnc program block might consist of multiple instruction (called G-Codes/M-Codes etc)
So these are the instructions which tell cnc machine what to do next, when to change tool, which axis to move, how much spindle speed is required with which gear.
These programs are made/written by CNC-Programmers, in the past most of program were written by hand (even today), but nowadays multiple software are available which ease this whole process.
So when the Part-program is complete those are brought to cnc machine, there are multiple mediums and ways to transfer the program to a cnc machine, floppy disks/flash card/networks are some of many ways used these days in workshops.
Now part program is stored inside the cnc machine memory called CNC Programs Directory. So now cnc machinist select the required part program for execution.
Then that part program is run by cnc machinist by pressing Cycle-Start, and now the control is transferred to the cnc machine control which now reads the part-program and instructs different parts of cnc machine to do the required operation. This way whole the part-program instructions are executed block by block.
If during this whole process anything goes wrong then cnc machinist can stop the cutting tool motion (Feed-Hold), or he can completely stop the machine (Cycle-Stop). Even cnc machinist can press Emergency-Stop-Button if anything dangerous happen or going to happen.
If everything goes well during part-program execution then machine automatically stops at the end of part program.