Thursday, March 28, 2013

Introduction to CNC Code

Introduction to CNC Code

Overview

Computer Numerical Control (CNC) is the process of having a machine controller manage the operation of a machine. This would include the table motions, the spindle speed, and various other machining functions. This is all accomplished by a program that is written using NC code. These coded instructions are carefully arranged by using letters (A,B,C,....Z), numbers (1,2,3...9) and symbols(+,-,/...etc.) to create a program. These instructions can range from a few lines for a simple part to many thousand of lines for a complex part. If the cumulative instructions (program) are written correctly it will provide specific guidance on exactly what functions you want the machine to perform, resulting in the production of a quality part. On the other hand, a poorly written program can have disastrous results... scraping parts, destroying tools, and possibly damaging the machine. In extreme cases the operator's own personal safety may be in jeopardy

The NC codes are the "language" that is recognized and understood by the CNC machine'scontroller. This language, like any language, has a specific structure to insure accurate communication. The NC code structure consists of characters, words, blocks, and programs.There are 9 charter types used in CNC  programming:
  1. letters A thru Z
  2. a number or combination of numbers 0 thru 9
  3. + plus sign
  4. - minus sign
  5. . decimal or period
  6. : colon
  7. ; semi-colon
  8. / slash
  9. % percent
Words, blocks, and programs are described on the following page

A Word

A NC word is a series of characters arranged in a specified order that provides a specific command
to the machine. A word consists of a address (discussed later) followed by numbers and/or symbols.
Here are some examples - but not all - of the typical words:

CNC Word and exampleDescription
F as in F12.0Feed rate (as in 12.0 inches per minute)
G as in G1Tool movement (as in linear interpolation while under feed control)
M as in M6Miscellaneous function (as in tool change command)
N as in N100Block sequence number (as in block number 100)
R as in R.25Arc radius (as in 0.25 radius)
S as in S1250Spindle speed (as in1250 RPM)
T as in T3Selection of tool (as in use tool number 3)
X as in X2.5X-axis coordinate. (as in 2.5 inches in the X direction)
Y as in Y4.75Y-axis coordinate. (as in 4.75 inches in the Y direction)

A Block
A block is a series of words that defines a single instruction. A block can be a single word or a
combination of words. A block is terminated by an 
end of block character (EOB). In some instances the
 EOB is visible and in some instances it is not. Some examples of blocks are provided below without a
visible EOB:
N89 M30                                                                    (two word block)
N11 T01 M06                                                             (three word block)
N05 G80 G90 G17                                                     (four word block)
N9 G01 X3.0 Y1.7 F40                                              (five word block)

Here are two examples of blocks that show an EOB:

N400 G0 X0.2;                                                              (three word block with ";" used as an EOB)
N5005 G90 G1 F20 X5 Y2 Z4$                                    (seven word block with "$" used as an EOB)


 A Program

A program is a series of blocks and normally contains a complete set of coded instructions required to 
completely machine a part or a predetermined portion of a part. A program can be as short as a few 
blocks or as long as many thousand blocks for complex parts. The program contains all the instructions
 and information necessary for the computer to command the machine to perform specified functions, 
ultimately resulting the complete machining of a part.

A program and all of its parts, can be equated to the English language as follows:

CNC Code LanguageEnglish Language EquivComment
CharacterCharacterThe characters are the same for both languages. (1,2,3...;,+,=,%....)
WordWordThe word is merely a combination of characters in both languages. It's just that the combination of characters in the NC Code Language is a little different than we are used to seeing, but they are still words none-the-less
BlockSentenceThe block is equivalent to a sentence in the English Language. They both convey specific thoughts or commands and have punctuation that end them.
ProgramMemo or LetterThe program is equivalent to a complete memo or letter in the English Language. They both are a combination of sentences/blocks that convey complete ideas (English) or completed parts (NC Code).

Address Words
The Address code is the single letter character (A-Z) at the beginning of each word that defines what the
 computer should do with the numerical data that follows. A list of the Addresses codes is shown here:
(Note that a few of the Address codes have multiple definitions)
Although these are the most commonly used Address code definitions for milling and turning, it is possible
that definitions may vary for different computer controllers. Always consult the operator's manual for the\
specific controller being used.
Two of the Address codes are considered major codes. The two major codes are G-codes

 photo ena-1.jpg

G Words

G words, commonly called G codes, are major address codes for preparatory functions which involves
 tool movement and material removal. These include rapidmoves, lineal & circular feed moves,dwell, and
 canned cycles. Through the years many of the G-codes have been standardized, but others are unique
 to a particular controller. The commonly used G-codes are briefly summarized below:
There are many other special feature and advanced machining G-codes that aren't commonly used,
 and therefore not discussed in this basic module. See the"G" glossasy listing for explanations of all of the
 G-codes

Note: always consult the operator's manual for the G-code definitions for your specific controller.

 photo enakaiena.jpg

M Words

M words, commonly called M-codes, are major address codes for miscellaneous functions that perform 
the instructions that do not involve tool movement.
These include spindle on and off, tool changescoolant on and off, and other similar related functions.
Most M-codes have been standardized, but there are a few that have a unique function for a particular
controller.
Many of the more common M-codes are described below:
Similar to the G-codes there are many other special feature and advanced machining M-codes that aren't
 commonly used, and therefore not discussed in this basic module.
Note: always consult the operator's manual for the M-code definitions for your specific controller.

 photo triatria.jpg
Article resource : www.jjjtrain.com



2 σχόλια:

  1. I think that with the influx of CNC mills into the cycling market that novelty will start to fade away and people will begin to realize that this is just an cnc precision machining over-glorification of functionality.

    ReplyDelete
  2. www.uzkarmakina.com cnc işlemleriniz için tıklayın. For Lathe CNC

    ReplyDelete