🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Manufacturing & Marine › CNC Machining › G-Code Programming for CNC Mills and Lathes › Lesson 1
MFG-CNC14-04 · Lesson 1 · 10 clock hours · theory

CNC Machine Architecture and the G-Code Ecosystem

Objective. Students identify the major hardware components of a CNC mill and lathe, describe the role of the MCU and servo system, and explain how a G-code file moves from editor to machine motion.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

What Is a CNC Machine?

A Computer Numerical Control (CNC) machine uses a stored program of coded instructions to move cutting tools and workpieces along precise paths. Unlike manual machines that depend entirely on the operator's hands, a CNC machine reads a file—your G-code program—and drives motors to position axes within thousandths of an inch. Two machines you will operate throughout this program are the Haas VF-2 vertical machining center (mill) and the Haas ST-10 turning center (lathe).

---

Major Hardware Components

The Machine Structure

The base and column are heavy cast-iron or polymer-composite castings that absorb vibration and hold all other components in rigid alignment. The table (mill) or headstock/tailstock (lathe) mounts the workpiece. Rigidity here directly affects dimensional accuracy, so never place extra weight on the table or hang tools off machine guarding.

Axes of Motion

CNC mills use a right-hand Cartesian coordinate system. Point your right hand so your fingers curl from the positive X axis toward the positive Y axis; your thumb points in the positive Z direction. On a vertical mill:

On a lathe, only two primary axes are used:

Some machines add a C axis (spindle rotation) or a Y axis for live-tool lathes.

The Spindle

The spindle holds and rotates the cutting tool (mill) or the workpiece (lathe chuck). It is driven by an AC servo or vector-drive motor. Spindle speed is commanded in RPM by the S word in G-code. Never reach into the work envelope when the spindle is enabled; use lockout/tagout (LOTO) before clearing chips by hand.

The Automatic Tool Changer (ATC)

The Haas VF-2 uses a side-mount tool changer (SMTC) that stores up to 20 tools (standard carousel) and swaps them on a T word / M06 command. The ST-10 uses a turret that indexes to the called tool position. Ensure hands and tooling are clear of the carousel or turret before issuing a tool-change command.

Servo Drives and Feedback

Each axis is powered by a servo drive and servo motor pair. The drive receives a velocity or torque command from the control and supplies the corresponding current to the motor. A rotary encoder or linear scale mounted on each axis sends position feedback back to the control hundreds of times per second. This closed-loop path is called the position feedback loop, and it is what allows the machine to hold tolerances of ±0.0002" or better in normal production conditions.

---

The Machine Control Unit (MCU)

The Machine Control Unit (MCU)—sometimes called the CNC controller—is the computer brain of the machine. On Haas machines it is the integrated control panel with its screen, keypad, and internal processor. The MCU performs three key jobs:

1. Interprets the G-code file line by line.

2. Calculates the required axis positions and feed rates using interpolation algorithms.

3. Commands the servo drives to move each axis simultaneously so the tool follows the programmed path.

The MCU also monitors alarms, manages tool-length offsets, and enforces soft travel limits that prevent the machine from crashing into its own structure.

---

How G-Code Gets to the Machine: The Full Workflow

| Step | What Happens | Data Format |

|------|-------------|-------------|

| 1. Design | Engineer or machinist creates a part drawing | CAD file (.dwg, .step, .iges) |

| 2. CAM | CAM software (e.g., Mastercam) reads the CAD geometry and generates toolpaths | CAM project file |

| 3. Post-Processing | CAM software runs a post-processor specific to the target machine/control | G-code text file (.nc, .tap, .cnc) |

| 4. Transfer | File is sent to the machine via USB, network (Ethernet/DNC), or typed directly at the control | Plain text |

| 5. Execution | MCU reads and executes each block; servo system moves axes; cutting happens | Real-world motion |

The post-processor is critical: it translates generic toolpath data into the exact dialect of G-code that a specific machine understands. A post written for a Haas mill will produce different code than one written for a Mazak or a Fanuc-based machine, even if the part geometry is identical.

---

G-Code File Structure Basics

A G-code file is a plain-text program made up of blocks (lines). Each block can contain:

Example block: `G01 X2.500 Y1.000 F10.0` commands a linear feed move to X 2.5, Y 1.0 at 10 inches per minute.

---

Safety in the Machine Environment

Key terms8

MCU (Machine Control Unit)The onboard computer of a CNC machine that interprets the G-code program, calculates interpolated axis positions, and commands the servo drives to produce the required motion.
Servo driveAn electronic amplifier that receives motion commands from the MCU and supplies the precise current needed to move a servo motor to a commanded position.
EncoderA position-sensing device mounted on a servo motor or linear axis that sends feedback pulses to the MCU so actual position can be compared to commanded position in a closed loop.
Post-processorA software translator inside CAM software that converts generic toolpath data into the specific G-code dialect required by a particular machine controller.
Right-hand ruleA convention for establishing positive axis directions in a Cartesian coordinate system: with the right hand, fingers curl from +X toward +Y and the thumb points in the +Z direction.
BlockA single line in a G-code program, containing one or more words (G, M, X, Y, Z, F, S, T) that the MCU reads and executes as a unit.
Automatic Tool Changer (ATC)A mechanical system (carousel on mills, turret on lathes) that stores multiple cutting tools and swaps them into the spindle or work position on command without manual intervention.
InterpolationThe MCU's calculation of all intermediate axis positions between a start point and an end point so multiple axes move simultaneously and the tool follows a straight line or arc.
In class: Label a cut-away diagram of a Haas VF-2 mill and a Haas ST-10 lathe, identifying the spindle, axes, tool changer, MCU, servo drives, and encoder feedback path. · Trace the workflow from CAD drawing to G-code file to machine execution using a flowchart exercise, then present one step to the class explaining the data transformation that occurs. · Read Chapter 1 of 'CNC Programming Handbook' (Smid, 3rd ed.) and answer 15 comprehension questions on Cartesian coordinates, axis nomenclature, and right-hand rule.
Materials: Haas VF-2 and ST-10 operator manuals; 'CNC Programming Handbook' (Smid, 3rd ed.); Cartesian coordinate worksheet; axis-labeling diagram; projector
Check: Scored 15-question quiz; students must correctly identify all major components and answer ≥12/15 (80%) to proceed.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

NIMS Machining L1 – CNC Setup and Operations
1. On a Haas VF-2 vertical machining center set up with the standard axis convention, which axis runs along the spindle's rotational centerline?
Mastercam Associate – CAM Workflow
2. What is the primary function of the post-processor in the CAD-to-CNC workflow?
NIMS Machining L1 – Safety
3. A technician needs to manually clear chips that have packed inside the work enclosure of a Haas VF-2. Which action must be taken FIRST?
NIMS Machining L1 – CNC Machine Components
4. Which component closes the position feedback loop between an axis servo motor and the MCU?
NIMS Machining L1 – G-Code Fundamentals
5. In a standard G-code block for a Haas mill, what does the F word specify?
NIMS Machining L1 – Coordinate Systems
6. Using the right-hand rule for a standard Cartesian coordinate system, if the positive X axis points to the right and positive Y points away from you, in which direction does positive Z point?
Haas Certification – Lathe Operations
7. On a Haas ST-10 turning center, which axis is parallel to the spindle centerline?
NIMS Machining L1 – CNC Machine Components
8. Which statement best describes the role of the Machine Control Unit (MCU) during program execution?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.