Instructions
g01 z-.3
g00 z.3
o300 call (x move)
o200 endsub
o300 sub (mill shape)
(mill shape g-code)
o300 endsub
(Main Program with a Sub Program Nesting Sample)
g90 g00 g40 g80 g54 g17 x0 y0 z0
g90 g00 x1.0 y1.0 (move into position for the starting point of the sub program)
o200 call (4 hole pattern)
g90 g00 x4.0 y1.0
o200 call (4 hole pattern)(Which also calls o300 sub (mill shape))
g90 g00 g40 g80 x0 y0 z0
m2
%
Again:
1. All o-codes must be defined by numbers (EX. o200, o154, etc).
2. No letters or words are allowed after the o-code number except the words (sub, call
and endsub).
3. No comments are allowed unless they are inside parentheses (xxxxx).
More handy g-codes
g-codes that you can learn as you need them
Canned cycles
There are quite a few canned cycles designed into the EMC2. They can save a lot of
repetitious programming. There are some others that EMC2 does not support or Sherline
machines cannot perform, so we’ll only consider the canned cycles that are useable with
Sherline CNC machines. These commands are primarily used for drilling and boring
cycles to save programming time when you have a lot of repetitious operations to
perform, like a series of holes. However, at this point you have learned enough g-codes to
be able to make most parts, and I believe you should take a break from learning and take
67