Typical CNC program is composed of series of sequential instructions related to machining a part. Each instruction is specified in a format the CNC system can accept, interpret and process. Each instruction must also conform to machine tool specifications. This program input method can be defined as an arrangement of machining instructions and related tasks, written in the format of a CNC system and aimed at a particular machine tool.
Various controls may have different formats, but most are similar. Subtle differences exist among CNC machines from different manufacturers, even those equipped with the same control system. This is common, considering the specific demands individual machine builders place upon the control manufacturer to accommodate many original and unique machine design features. Such variations are usually minor but still important for programming.
Basic Programming Terms
The field of CNC has its own terminology, special terms and its jargon. It has its own abbreviations and expressions that only people in the field understand. CNC programming is only a small section of computerized machining and it has a number of its own expressions. The majority of them relate to the structure of part programs.
There are four basic terms used in CNC programming. They appear in professional articles, books, papers, lectures and so on. These words are the key to understanding general CNC terminology:
|Character -> Word -> Block -> Program|
Each term is very common and equally important in CNC programming and deserves its own detailed explanation.
A character is the smallest unit of CNC program. It can have one of three forms:
Characters are combined into meaningful CNC words. This combination of digits, letters and symbols is called the alpha-numerical program input.
There are ten digits, 0 to 9, available for use in a program to create numbers. The digits are used in two modes – one for integer values (numbers without a decimal point), the other for real numbers (numbers with a decimal point). Numbers can have positive or negative values. On some controls, real numbers can be used with or without the decimal point.Numbers applied in either mode can only be entered within the range that is allowed by the control system.
All twenty six letters of the English alphabet are available for programming, at least in theory. Most control systems will accept only certain letters and reject others. For example, a two-axis CNC lathe control will reject the letter Y, as the Y-axis is typically unique to milling operations (milling machines and machining centers). On the other hand,many CNC lathes with milling capabilities will accept the letter (address) Y, if the Y-axis is available. Capital letters are normal designation in CNC programming, but some controls accept low case letters with the same meaning as their upper case equivalent. If in doubt, use capital letters.
|Every control accepts CAPITAL letters but not all controls accept low case letters.|
Several symbols are used for programming, in addition to the ten digits and twenty six available letters. The most common symbols are the decimal point, minus sign, percent sign, parenthesis and others, depending on the control options. Their use in a program is strictly defined. Decimal point is used for values expressed in mm, inches or degrees. Minus sign is used to identify a dimensional value as negative, percent sign is used for file transfers, and parentheses are used for program comments and messages.
A program word is a combination of alpha-numerical characters, creating a single instruction to the CNC. Each word begins with a capital letter, followed by a number representing a program code or actual value. Typical words indicate axes position, feedrate, speed, preparatory commands, miscellaneous functions and many others.
|Word is the unit of instruction to the control system.|
Just like one word is used as a single instruction to the CNC system, program block is used as a multiple instruction. A program entered into the control system consists of individual lines of instructions, sequenced in a logical order of processing. Each line – called a sequence block or simply a block – is composed of one or several words and each word is composed of two or more characters.
In the control system, each block must be separated from all others. To separate blocks in theMDI (Manual Data Input) mode at the control, each block has to end with a special End-Of-Block code (symbol). This code is marked as EOB on the control panel. When preparing part program on a computer using a keyboard, using the Enter key will terminate the block (similar to the old Carriage Return on typewriters). When writing a program on paper first, each program block should occupy only a single line on the paper. Each program block contains a series of individual instructions that are executed simultaneously.
Part program structure may vary quite a bit for different controls, but the logical programming approach does not change from one control to another. CNC program usually begins with a program number or similar identification, followed by sequenced blocks of instructions in a logical order. The program ends with a stop code or a program termination symbol, such as the percent sign – %. Some controls also require the stop code at the program beginning. Internal documentation and messages to the CNC operator may be located in strategic places within the part program. Programming format has evolved significantly during the years and several formats have emerged.