The Enhanced Machine Control (EMC) Basic Rules


LinuxCNC it the "home of users of the Enhanced Machine Controller - EMC". There's everything about the EMC there - definitions, howtos, configurations, helps. There's this wonderful users manual (PDF) which I am reading now, and has all the vital information for understanding how the EMC works. Here are some first interesting points that I noted, but if you want to know (much) more, read the whole manual.

The Enhanced Machine Controller (EMC2) can control machine tools, robots, or other automated devices. It can control servo motors, stepper motors, relays, and other devices related to machine tools.

There are four main components to the EMC2 software: a motion controller, a discrete I/O controller, a task executor which coordinates them, and graphical user interfaces. In addition there is a layer called HAL (Hardware Abstraction Layer) which allows configuration of EMC2 without the need of recompiling.

User Interface

A user interface is the part of the EMC2 that the machine tool operator interacts with. The EMC2 comes with several types of user interfaces:

  • AXIS an OpenGL-based GUI (Graphical User Interface), with an interactive G-Code previewer. This interface is one of the few that are still under active development and improvement.
  • Keystick a character-based screen graphics program suitable for minimal installations (without the X server running).
  • Xemc an X Windows program
  • two Tcl/Tk-based GUIs named TkEMC and Mini
  • a HAL based user interface called halui, which allows to control emc2 using knobs and switches
  • a telnet based user interface called emcrsh, which allows commands to be sent to emc2 from remote computers

When an EMC2 is running, there are three different major modes used for inputting commands. These are Manual, Auto, and MDI. Changing from one mode to another makes a big difference in the way that the EMC2 behaves. There are specific things that can be done in one mode that can not be done in another. An operator can home an axis in manual mode but not in auto or MDI modes. An operator can cause the machine to execute a whole file full of G-codes in the auto mode but not in manual or MDI.

Trajectory Planning

Trajectory planning, in general, is the means by which EMC follows the path specified by your G Code program, while still operating within the limits of your machinery. A G Code program can never be fully obeyed. For example imagine you specify as a single-line program the following move:

G1 X1 F10 (G1 is linear move, X1 is the destination, F10 is the speed)


After starting EMC2 each axis must be homed prior to running a program or running a MDI command. Homing each axis and having the machine limits correctly set will prevent you from running a program that would exceed any travel for an axis.

If your machine does not have home switches you should jog each axis to a match mark and home at the same place each time. Just because you
home an axis in a particular spot does not limit you to how a program center is done. For example if you home your X axis with the table all the way to the right (the tool is in the left most position) and you encounter a g code program that has the X axis 0 position in the center of the part you jog over to the center of the part and touch off the X axis (using the AXIS interface).

If you want to deviate from the default behaviour, or want to use the Mini interface you will need to set the option NO_FORCE_HOMING = 1 in the [TRAJ] section of your ini file.

Touching Off

Touching Off is how you tell EMC where your tool and material is. For example if you have a g code program that referenced the X zero from the left side of the material (viewed from the front) and referenced the Y zero from the back side of the materal and the Z zero from the top of the material. Touching off is how you set the X zero, Y zero, and Z zero positions for the cooridnate system your using. In the AXIS interface you simply move the tool to a known position for that axis then select the radio button for that axis on the Manual Control tab then select Touch Off and enter in any offset.

If for an example you are using an edge finder and locating the left edge of your material and the edge finder has a 0.100” offset then once you find the edge you select touch off and enter -0.100 indicating that your present position is 0.100” to the left of edge of the part. One method for touching off Z axis is to have a cylindrical part of known diameter and to lower the tool tip to a point where the cylinder will not roll under the tool, then raise the Z up slowly until the cylinder just rolls under the tool tip. Then touch off and enter the diameter of the cylinder and your Z zero will be set to the top of the material. For more information on coordinate systems see the Coordinate System Chapter (16) in this manual.