CNCCookbook  Software and Information for Machinists

CNCCookbook's G-Code Course



MDI: CNC For Manual Machinists

CNCCookbook's G-Code Tutorial


CNC Can Be Quick and Dirty Too!

Many manual machinists are under the impression that CNC is only good for manufacturing multiple identical parts, and that one offs are a lot faster to do on manual machines. They have visions of spending hours making CAD drawings of even the simplest parts and then feeding those CAD drawings through a CAM program to finally produce G-Code, at which point they are finally ready to make some chips.

It just ain't so!

Good CNC machinists can do most anything a manual machinist can do and then some. This article is all about how.

Lathe Gal

You can do anything on your CNC that the manual machinist can and often faster once you know how...

DRO's and Power Feeds

The first trick is to forget about G-Code, CAD, and CAM. Think of that fancy CNC machine as nothing more than a manual machine that has DRO's (digital read outs) and Power Feeds on all of the axes. Most manual machinists would see that as a tremendous improvement over handwheels and no DRO's, and wouldn't hesitate to use such a machine. Once you get used to the idea of using your CNC in that capacity, you'll be surprised at how easy it is.

Fanuc Panel

A typical Fanuc panel you might use...

But how does it work? The CNC certainly doesn't look like a manual machine with DRO's and Power Feeds. There's way more knobs and buttons and no handwheels!

Let's deal with the DRO's first. By now you will have seen that the front panel of your CNC displays the X, Y, and Z coordinates at all times. See all those X, Y, Z, and A displays on the Fanuc panel above? Those are DRO's.

What about those Power Feeds?

There are two approaches. First of all, CNC's have the ability to jog. Jogging is where you're spinning a simulated electronic handwheel, or holding down a button or joystick to make the axis move. You generally select an axis, select a speed or multiplier (x1, x5, x100 or whatever), and then operate the control to move the axis. It's pretty easy. Here is a typical pendant with an electronic handwheel (called an "MPG" or "Manual Pulse Generator") for jogging:


A pendant for jogging a CNC. Select axis and speed then spin the wheel...

But, there is a better approach if you're actually trying to do some machining as opposed to touching off a setup, and it's called "MDI".

MDI quite simply stands for "Manual Data Input", and that is what it is. You put your machine into MDI mode, and it lets you directly type in G-Codes which are executed immediately, instead of having to create and run a program. MDI is extremely useful to know your way around. Check out this Mach3 Standard Mill home screen:

Mach3 Standard Mill

Mach3 Standard Mill Screen Set...

You can see the XYZ DRO's on the lower right. Just to the left of them is the MDI type-in field. When not running a program, you can type G-Code commands into the MDI field for immediate execution. Look up in your operator's manual how to go about accessing MDI for your controller.


Using MDI to Move the Axes

To use MDI to move the Axes of your machine, you need to know a couple of G-Codes.

G00 (some machines will accept G0 too) tells the machine to expect rapids motion. It is a mode, as we discussed earlier. Most CNC's come up with G00 active by default, meaning if you enter coordinates, they'll cause rapid moves. "Rapids" are when your machine moves absolutely as fast as it can to the place you've commanded it to move.

I want you to ignore G00 and rapids when you MDI for the time being if you're just starting out. You don't really need the machine to move at its fastest possible speed as a beginner--it just makes it easier for the machine to get away from you.

Instead, I'd like you to try to remember to perform a G01 command at the beginning of any session. That tells the CNC to switch from rapids to linear interpolation. It amounts to the same thing but you have a fine ability to control the speed the machine moves at using the "Feedrate" command, which is just an F. So for example, you might start up the machine and first thing you do is type in something like "G01 F20" in the MDI. What that will do is limit your machine's speed to 20 units/minute. If you're in inches, its 20 IPM. For metric it'll be mm/minute.

Now the axis motions will be a lot less scary and easier to manage. If you know the feedrate you want to do your cutting at, use the "F" word to establish that feedrate. If you don't, try something like G-Wizard Calculator to determine a good feedrate.

Practice moving the axes around with MDI. If you're not already in G01 mode, enter "G01" to the MDI. Enter your feedrate using the "F" word--F20 for 20 IPM, for example. To make a move, simply enter the appropriate axis coordinates on the line. The machine will move using what's called "linear interpolation". This means multiple axes move at rates so that they all get to the end coordinates you've specified at the same time. If you don't need an axis to move from its current coordinate, just don't specify it.

For example, suppose you want to make a cut in the X axis. You've issued the "G01" and "F" words (G-Code calls those letters "Words") and you're ready for the coordinates. Let's say your cutter is all lined up for a face milling pass, and is sitting at the correct Y and Z coordinates. You've got a workpiece 5" long in X, the X coordinate on the console says 7.125 and the cutter is spinning about 1/2" off the edge. What do you do?

Well, you want to move the 5" and leave 1/2" on either side. Let's allow even a little more than that to be sure the cutter clears the workpiece--after all, we're just eyeballing quick and dirty. So, type "X1.0" and the machine will feed the spindle right to left moving across the workpiece in the X direction.

Pretty easy, huh?


Firing Up Spindle and Coolant with M-Codes

Consider that a hypothetical case. Had we been doing it for real, we would've needed to fire up the spindle and the coolant. So let's take time to learn a couple more codes.

While the whole language is commonly referred to as "G-Code", and we have certainly used G-Codes G00 and G01 thus far, we're going to need some "M-Codes" to control the spindle and coolant. Think of M-Codes as "Miscellaneous" codes. Fanuc refers to M-Codes as "Auxilliary" functions.

To start your spindle going, let's first select a speed with the "S" word (S for Speed, it's easy to remember most of these codes). Let's go for 4000 rpm by entering S4000 in the MDI. The spindle won't actually start to rotate until we ask it to because it doesn't know whether to go clockwise or counterclockwise. Enter "M03" for clockwise rotation and your spindle should spin up to 4000 rpm in the clockwise direction. Coolant is switched on using M08 for flood and M07 for mist or just air, depending on how the machine is set up.

You can stop the spindle by typing "M05", and you can shut off all coolant with "M09".

M13 and M14: Start Spindle and Coolant

On some machines, typically lathes, you may find M13 and M14. These m-codes start the spindle and the coolant at the same time. M13 starts the spindle running clockwise and M14 runs counterclockwise. Stop the spindle with M05 and coolant with M09.


Now you've got the gist of using MDI. There are many more g- and m-codes you can use with MDI, but those are all the ones you need to do everything a manual mill with power feeds and DRO's can do.


Using G-Wizard Editor's Wizards to Help Keep Track of the Codes

You're probably starting to wonder how you're going to memorize all these codes. After all G00 and G01 don't exactly mean anything by themselves--they're pretty arbitrary. Don't worry, there aren't all that many g-codes you'll be using on a regular basis, certainly not on MDI. You'll pick them up quickly with practice, and for the rest, there are quick reference tables and other tools.

One handy tool is G-Wizard Editor's G-Code Wizards. They remember all this for you so you don't have to remember the exact codes when you're writing a program. For example, the Toolbar groups different G-Code functions you can select for entry:

GWE Wizards

The buttons to the right of "Insert" trigger the various code insertion Wizards...

If you select "M-Code" (or type "Ctrl+M" for M-Code on the keyboard), you'll get the Wizard for entering M-Codes:

M-Code Wizard

Each code is called out with a description of what it does...

Each code is called out in the list with a description of what it does. Just select the code you want (or type its number, the Wizards are designed so you need not use a mouse) and click "Insert" (or press Enter) and it goes into your program.

Don't see it on the list? You can close and pop up a different Wizard or switch directly to G-Codes using the radio button at the top of the panel. The G-Code Wizard is a little fancier than the M-Code Wizard:

G-Code Wizard

G-Codes are grouped in categories...

The G-Codes are grouped into categories by the buttons at the top to help you narrow your search. So far we have only considered G-Codes from the Motion category, G00 and G01, but there are many more and we'll be going through all of them.

Another thing to note: the Wizards only show you codes that are enabled by the Post for your control so you can't inadvertantly enter a code that won't be recognized and will cause an alarm (CNC jargon for an error). There are a lot more handy capabilities in the Wizards that we'll be covering during the rest of this course.


Quick Reference

Here is a little quick references of the commands we've discussed that are useful for MDI. You can print it out to keep near the machine until you memorize them. These codes and the ability to use MDI on your machine and read the console DRO display is all that's needed to run your CNC like a manual mill with DRO's and Power Feeds.

MDI G-Code Quick Reference
G00 Rapid motion mode. Remember: We're going to use G01 instead, so type G01 in to cancel G00 as soon as you bring up MDI!
G01 F<ipm> Linear Interpolation mode. Motion in a straight line at the feedrate established by "F". You can change feedrate without issuing a G01 each time.
XYZ Move to the specified coordinates in a straight line.
ABC Move the rotational axis to the specified angle.
S<rpm> M03 Set spindle to rpm and start it turning clockwise. You can change spindle rpm without issuing an M03 each time.
M05 Stop spindle
M08 Flood coolant on
M07 Mist or Air coolant on
M09 All coolant off


Final Word: Watch Out Below!

MDI is almost too easy, in fact. I broke more tools when I was learning CNC by fat fingering MDI than running programs. If you get confused, it's very easy to start the cutter moving at high speed in totally the wrong direction. If you're lucky, it'll strike the edge of the workpiece moving too quickly and just snap off the cutter clean. If you're not so lucky, you can run it into the vise or worse, your table.

Here are some tips to try to cut down on the incidence of accidents with MDI:

- Always think carefully about what's about to happen before hitting the Enter key to initiate the MDI command.

- The bigger the tool, the worse the mishap if it crashes. Start out with small cheap endmills and leave the big expensive facemills and indexable tooling until you're sure you have the hang of it.

- Beware dropped digits and signs. This is an easy way to go somewhere you didn't expect.

- Use your FRO (Feedrate Override) to slow everything down until you're sure. In fact, crank it way down before you start the command and inch it up as things look to be going okay.

- Remember, avoid G00 and stick to G01 with a slow feedrate. First because you'll move more slowly and second because you won't get confused about whether the machine is in G00 or G01 when you're first starting out.

- Use your pendant and jog. It's easier to let up if things start to get pear shaped on you. Save MDI for feeding cuts.

- Entering the workpiece or moving close to the workpiece requires the most vigilance. Once you're in the neighborhood, small moves at feedrates are less likely to be a problem.

- Before you issue an MDI, make sure you know where the big red E-Stop button is. Visualize pressing it a couple of times. Don't hesitate to reach for it if you don't understand what's going on.

- A lot of CNC controllers have a distance to go DRO readout. Use it to make a quick check as the cutter starts getting close to cutting--if distance to go is wildly greater than the amount you expect the cutter to have to move to finish your command, you have a problem.

- Don't allow distractions while you're running the machine. Give it your full attention, and don't walk away. When a pilot is landing a plane, he uses his full concentration--all conversation in the cockpit not specific to landing the plane is stopped.


1. Take out your manual and figure out how to jog your CNC machine and how to issue MDI commands.

2. Use GWE as a G-Code simulator. Start with an empty file and issue your faux-MDI commands by just typing them into the text pane. Watch what happens. Get good at predicting what will happen. Learn to make the cutter go where you want it to go.

3. Once you've mastered getting G01 to go where you want it to in GWE, get comfortable practicing MDI commands on the machine without turning on the spindle. Start out with the spindle high above anything it might touch, and don't issue any "Z" axis moves until you've got the hang of X and Y.

4. Load a piece of scrap material and a cutter and try some practice passes under MDI control.

5. Learn to use touch offs and an edge finder to precisely locate the tool just as you would with your manual machine. If you don't know how to do this, stay tuned as we're covering it next.

6. A great next step after learning MDI is CNC Conversational Programming. Check out G-Wizard Conversational to give it a try.




No credit card required--just your name and email.


Next Article: One Shot and Modal G-Codes








  GW Calculator

  GW Editor



  Deals and Steals











     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     Lean Manufacturing

     Cost Estimating Software

     DIY CNC Cookbook

     CNC Dictionary


CNC Projects


     CNC Mill Retrofit

     Plasma Table


      3D Printers



     Machinist's Search


     Online Groups


     Reference Data



     Tool Brands


     Hall of Fame






     Our History

     Cheapskate Page

     Privacy Policy

All material © 2010-2014, CNCCookbook, Inc.