CNC – Computer Numerical Control Word Address Programming Character: an alphanumeric character or punctuation mark Address: a letter describing the meaning of a number following the letter Word: an address followed by a number, used to describe machine motions and dimensions Block: a complete command to the CNC machine (one or more words, depending on the information needed to command a CNC operation) Program: a sequence of blocks describing the motions of a CNC machine to manufacture a part N G ; G 00 X -3.75 G00 X-3.75 N010 G00 X-3.75 Y2.5 N010 G00 X-3.75 Y2.5 N020 G00 Z1. . . . . N0100 M30
CNC – Computer Numerical Control Word Address Programming General Syntax (arrangement of addresses in a block): O – program number (optional), used to identify programs in the MCU memory. Ex: O 0001, O 9999 N – sequence number (optional). MCU executes a program block by block regardless of the sequence number entered. Ex: N 0001, N 9999 G – preparatory functions , usually placed at the beginning of a block and used to prepare the CNC controller to act in a particular mode when processing the other words in a block. The mode is indicated by the numerical value following the G address. Ex: G 00 ( Rapid positioning at maximum feedrate ), G 01 ( linear interpolation at a programmed feedrate ) G 20 ( inch mode ) G 28 ( return to reference point ) G 90 ( absolute positioning ) G 91 ( incremental positioning )
CNC – Computer Numerical Control Word Address Programming G code categories: Modal : the G code specification will remain in effect for all subsequent blocks unless replaced by another associated modal G code. Nonmodal : the G code specification will only affect the block in which it appears . Ex: N0010 G91G01X1.0F10.0 N0020 X2.0 N0030 Y2.0 N0040 G90G00Y0 N0050 G28 X , Y , Z , … – dimension words , used to specify the movement of the programming axes (Cartesian coordinate system). G91, G01, G90 and G00 are modal G28 is non-modal
CNC – Computer Numerical Control Word Address Programming F – feed rate , the rate at which the spindle moves along a programming axis. F is modal English system: in/min Metric system: mm/min Ex: F10. – a feedrate of 10 in/min, F10 – a feedrate of 0.001 in/min ( Fanuc controllers ) S – spindle speed , the speed at which the spindle rotates (rpm) Spindle rotation should be specified prior to axis movement M – miscellaneous machine function , used to specify machine functions other than dimensional or axis movements Ex: M 03 (spindle on, clockwise) M 05 (spindle off) M 08 (coolant on) M 09 (coolant off) M 30 (program end)
CNC – Computer Numerical Control
CNC – Computer Numerical Control Linear Interpolation Machine a rectangular block 3” 2” 0.5”. Cutter ½” end mill. Part zero: X 0 & Y 0 at lower left-hand corner. Z 0 at top of the part.
CNC – Computer Numerical Control Linear Interpolation Machine a rectangular block 3” 2” 0.5”. X0 & Y0 at lower left-hand corner. Z0 at top of the part. Cutter ½” end mill. O0001 N0010 G20 G90 N0020 G92 N0030 T01 M06 N0040 M03 S800 N0050 G00 X-.5 Y-.5 N0060 G00 Z.25 N0070 G01 Z-.55 F5.0 N0080 G01 X-.25 Y-.25 N0090 Y2.25 N0100 X3.25 N0110 Y-.25 N0120 X-.5 N0130 Z.25 N0140 G00 Z 1.0 N0150 M05 N 0160 G28 N0170 M30 X=-0.5 Y=-0.5 Z=.25 Y X Z X=M.HOME Y=M.HOME Z=M.HOME X=-0.5 Y=-0.5 Z=-0.55 X=-0.5 Y=-0.5 Z=M.HOME X=-0.25 Y=-0.25 Z=-0.55 X=-0.25 Y=2.25 Z=-0.55 X=3.25 Y=2.25 Z=-0.55 X=3.25 Y=-0.25 Z=-0.55 X=-0.5 Y=-0.25 Z=-0.55 X=-0.5 Y=-0.25 Z=.25 X=-0.5 Y=-0.25 Z=1.0 X=-0.5 Y=-0.25 Z=1.0
CNC – Computer Numerical Control Circular Interpolation Circular Interpolation commands G02 & G03 – for cutting a circular contour It moves the tool along a circular path from the initial (current) position to the final position at a programmed feedrate Note:(1) Circular interpolation is executed on a plane . Plane selection (modal commands): G17 – XY (default), G18 – XZ, G19 – YZ (2) Tool motion direction: G02 – clockwise ; G03 – counterclockwise (3) Absolute or Incremental coordinates are being used General Syntax: G02 (G03) Xn Yn (Zn) In Jn ( Kn ) (Fn)
CNC – Computer Numerical Control Circular Interpolation Example: N010 G90 (Absolute) N020 G17 (XY Plane) N040 G01 X3.0 Y.25 F10.0 N040 G02 X4.125 Y-3.9486 I0. J-2.25 Calculation: End Position: X=3+2.25cos(60) Y=-2-2.25sin(60) I and J: (center-initial) I=3-3 J=-2-0.25 Y X 2 3 X Y 60 R 2 J Initial position of ½” tool End position
CNC – Computer Numerical Control Circular Interpolation Circular Interpolation via Radius Specification – coding the radius (R) of the circular arc instead of I, J, and K General Syntax: G02 (G03) Xn Yn (Zn) Rn (Fn)