Search This Blog

Showing posts with label Sub Program Repeat. Show all posts
Showing posts with label Sub Program Repeat. Show all posts

Sunday, November 16, 2014

"What is M-CODE M97, M98 & M99 (Sub Programs or Sub Routines) Mean in CNC Programming"

M-Code M97, M98 and M99 Subprogramming M-Codes

M97 Local Sub-Program Call (P, L):  

M97 is the M-code Used to call a Subprogram with the reference of the line number N within the same program. Pxxxx code is used as a line number to be repeated. Xxxx is the line number in the same program. This is used for the simple program within the program and does not require complication of creating a sub program. A local sub-program must end with an M99. If there is a repetition of the loop of subprogram L count on the M97 line, the sub-program will be repeated L number of times.

M97 Program Format:


M97 Pxxxx Lnn
Whereas,        xxxx is the line number
                        nn is the number of repetitions

Example:


Main program:
O01234 (Program number and Start of main program)
N0001 T02 M06;
N0002 T03
N0003 G54 G90 G00 Z50
...
...
...  (Part program)
...
M97 P0015 L3 (Jumps to line N0015, after the M30, to execute a local sub-program for 3 times)
...         (The M99 at the end of the sub-program will cause it to jump back here.)
...
...
... (Finish part program)
...
M30 (End of main program)
N0015 (Identifies the start of the Local Sub-Program called up by M97 P0015)
...
... (Local sub-program portion of Main program)
...
M99 (Jumps back to the line after local sub-program call in the main program)

M98 Sub-Program Call (P, L):  

M98 is the M-code Used to call a Subprogram with the reference to the separate program created and loaded on the controller. The Pxxxx code is the sub-program number being called; it must be in the same block as the M98. A sub-program must end with an M99 to enter to main program after the subprogram. If there is a repetition of the loop of subprogram L count on the M98 line, the sub-program will be repeated L number of times before continuing to the next block.

M98 Program Format:


M98 Pxxxx Lnn
Whereas,        xxxx is the line number
                        nn is the number of repetitions

Example:

Main program:

O01234 (Program number and Start of main program)
N0001 T02 M06;
N0002 T03
N0003 G54 G90 G00 Z50
...
...
... (Part program)
...
...
M98 P111 (Jumps to program O00111 to execute sub-program)
... (The M99 at the end of the sub-program will jump back here)
...
... (Finish part program)
...
M30 (End of main program)

Sub-program:

O00111 (Identifies the start of a separate sub-program)
...
... (Sub-program portion of part)
...
M99 (Jumps back to the line after the sub-program call in the main program).

M99 End Sub-Program or Return or Loop:

           This M-code is used to end the sub-program.  If M99 is used in the main program, it will cause the program to loop back to the beginning and repeat over and over again without stopping.

Example:


Main program:


O01234
...
... (Complete part program)
...
...
M99 (This will cause the program to jump back to the beginning and repeat itself)
An M99 without a P code at the end of a sub-program will return to the main Program.)

Main program:


O01234
...
... (Part program)
...
M98 P111 (Jumps to program O00111 to run)
... (The M99 at the end of the sub-program will jump back here)
...
... (Finish part)
...
M30 (End of main program)

Sub-program:


O00111 (sub-program number)
...
... (Sub-program portion of part)
...

M99 (Jumps back to the line after the sub-program call)

Thursday, November 13, 2014

A to Z Letter address used on CNC Machining

A to Z Letter address used on CNC Machining


Letter Address
 Description
Refers to



A
 Angular Value about the X-axis. Measured in degrees
 Axis nomenclature



B
 Angular Value about the Y-axis. Measured in degrees
 Axis nomenclature



C
 Angular Value about the Z-axis. Measured in degrees
 Axis nomenclature



D
the tool diameter or radius used for cutter
compensation
Cutter compensation Parameter



E
second feed function
accuracy required when cutting a corner



F
Feed word (code)
Feed words



G
Preparatory word (code)
G-code Words



H
Unassigned/specifying for tool height compensation




I
 Interpolation parameter or thread lead parallel to the X-axis
Circular interpolation and threading



J
 Interpolation parameter or thread lead parallel to the Y-axis
Circular interpolation and threading



K
 Interpolation parameter or thread lead parallel to the Z-axis
Circular interpolation and threading



L
Unassigned




M
Miscellaneous or auxilliary function
Machine Control Codes



N
Sequence number
Program Line numbers



O
 Sequence number for secondary head only
Indicates Program Number



P
P address character is used for a dwell time
Delay of time



Q
character is used in canned cycles
Depth specification



R
used in canned cycles or circular interpolation
 Axis nomenclature



S
Spindle-speed function
 Spindle speed



T
Tool Change function
 Tool function



U
Secondary-motion dimension parallel to X
 Axis nomenclature



V
Secondary-motion dimension parallel to Y
Axis nomenclature



W
Secondary-motion dimension parallel to Z
Axis nomenclature



X
Dimension of Tool movement in X direction
Axis nomenclature



Y
Dimension of Tool movement in Y direction
Axis nomenclature



Z
Dimension of Tool movement in Z direction
Axis nomenclature


ALPHABETICAL ADDRESS CODES

The following is a list of the Address Codes used in programming the Mill.

A -  FOURTH AXIS ROTARY MOTION:

The A address character is used to specify motion for the optional fourth, A- axis, which is angular value about X-axis. It specifies an angle in degrees for the rotary axis. It is always followed by a signed number and up to three fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/1000 degrees.

B -  FIFTH AXIS ROTARY MOTION:

The B address character is used to specify motion for the optional fifth, B, axis, which is angular value about Y-axis. It specifies an angle in degrees or the rotary axis. It is always followed by a signed number and up to three fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/1000 degrees.

C -  AUXILIARY EXTERNAL ROTARY AXIS:

The C address character is used to specify motion for the optional external sixth, C, axis, which is angular value about Z-axis It, specifies an angle in degrees for the rotary axis. It is always followed by a signed number and up to three fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/1000 degrees.

D - TOOL DIAMETER OFFSET SELECTION:

The D address character is used to select the tool diameter or radius used for cutter compensation. The number following must be between 0 and 200 (100 programs on an older machine). The Dnn selects that number offset register that is in the offset display which contains the tool diameter/radius offset amount when using cutter compensation (G41 G42). D00 will cancel cutter compensation so that the tool size is zero and it will cancel any previously defined Dnn.

E -  ENGRAVING FEED RATE / CONTOURING ACCURACY:

The E address character is used, with G187, to select the accuracy required when cutting a corner during high speed machining operations. The range of values possible is 0.0001 to 0.25 for the E code.

F - FEED RATE:

The F address character is used to select the feed rate. It is either in inches per minute with four fractional positions or mm per minute with three fractional positions.

G - PREPARATORY FUNCTIONS (G codes):

The G address character is used to specify the type of operation to occur by the tool in the block containing the G code. The G is followed by a two or three digit number between 0 and 187. Each G code defined in this control is part of a group of G codes.

H - TOOL LENGTH OFFSET SELECTION:

The H address character is used to select the tool length offset entry from the offsets memory. The H is followed by a two digit number between 0 and 200 (100 programs on an older machine). H0 will clear any tool length offset. You must select either G43 or G44 to activate a tool length (H) offsets. The G49 command is the default condition and this command will clear any tool length offsets.

I - CIRCULAR INTERPOLATION / CANNED CYCLE DATA:

The “I” address character is used to specify Interpolation parameter or thread lead parallel to the X-axis. It is defined in inches with four fractional positions or mm with three fractional positions.

J - CIRCULAR INTERPOLATION / CANNED CYCLE DATA:

The J address character is used to specify Interpolation parameter or thread lead parallel to the Y-axis. It is defined in inches with four fractional positions or mm with three fractional positions.

K - CIRCULAR INTERPOLATION / CANNED CYCLE DATA:

The K address character is used to specify Interpolation parameter or thread lead parallel to the Z-axis. It is defined in inches with four fractional positions or mm with three fractional positions.

L - LOOP COUNTS TO REPEAT A COMMAND LINE:

The L address character is used to specify a repeat count for some canned cycles and auxiliary functions. It is followed by a number between 0 and 32767.

M - M-CODE MISCELLANEOUS FUNCTIONS:

The M address character is used to specify an M code. These codes are used to control miscellaneous machine functions.

N - NUMBER OF BLOCK:

The N address character is used to identify or number each block of a program. It is followed by a number between 0 and 99999.

O - PROGRAM NUMBER:

The O address character is used to identify a program. It is followed by a number between 0 and 99999. You can have up to 500 program numbers (200 programs on an older machine) in your List of Programs.

P - DELAY OF TIME / M98 PROGRAM NUMBER Call:

The P address character is used for either a dwell time in seconds with a G04, or in canned cycles G82, G83, G86, G88, G89 and G73. When used as a dwell time, it is defined as a positive decimal value between 0.001 and 1000.0 in seconds. When ‘P” is used to search for a program number with an M98, or for a program number block in an M97. When P is used in a M97 or M98 the P value is a positive number with no decimal point up to 99999.

Q - CANNED CYCLE OPTIONAL DATA:

The Q address character is used in canned cycles and is always a positive number in inches between 0.001 and 100.0.

R - CIRCULAR INTERPOLATION / CANNED CYCLE DATA:

The R address character is used in canned cycles or circular interpolation. It's either in inches with four fractional positions or mm with three fractional positions. It is followed by number in inches or metric. It's usually used to define the reference plane for canned cycles.

S - SPINDLE SPEED COMMAND:

The S address character is used to specify the spindle speed; The S is followed by an unsigned number between 1 - 99999. The S command sets the desired speed.

T - TOOL SELECTION CODE:

The T address character is used to select the tool for the next tool change. The number following must be a positive number between 1 and (20) the number in Parameter 65.

U - AUXILIARY EXTERNAL LINEAR AXIS:

The U address character is used to specify motion for the optional external linear, U-axis.
It specifies a position of motion in inches. It is always followed by a signed number and up to four fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/10000 inches. The smallest magnitude is 0.0001 inches, the most negative value is -8380.0000 inches, and the largest number is 8380.0000 inches.

V - AUXILIARY EXTERNAL LINEAR AXIS:

The V address character is used to specify motion for the optional external linear, V-axis.
It specifies a position of motion in inches. It is always followed by a signed number and up to four fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/10000 inches.

W - AUXILIARY EXTERNAL LINEAR AXIS:

The W address character is used to specify motion for the optional external linear, W-axis.
It specifies a position of motion in inches. It is always followed by a signed number and up to four fractional decimal positions. If no decimal point is entered, the last digit is assumed to be 1/10000 inches.

X - LINEAR X-AXIS MOTION:

The X address character is used to specify motion for the X-axis. It specifies a position or distance along the X-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is followed by a signed number in inches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.

Y - LINEAR Y-AXIS MOTION:

The Y address character is used to specify motion for the Y-axis. It specifies a position or distance along the Y-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is followed by a signed number in inches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.

Z - LINEAR Z-AXIS MOTION:

The Z address character is used to specify motion for the Z-axis. It specifies a position or distance along the Z-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is followed by a signed number in inches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.