bmfs 3373 cnc technology lecture 8

17
BMFS 3373 CNC TECHNOLOGY Lecture 8

Upload: serge

Post on 24-Feb-2016

89 views

Category:

Documents


10 download

DESCRIPTION

BMFS 3373 CNC TECHNOLOGY Lecture 8. Lecture Objectives. At the end of the lecture, you will be able to: Explain what subprogram is. Understand the commands and rules for creating and processing subprograms. Describe the advantages of subprogramming. Subprogram Concept. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: BMFS 3373 CNC TECHNOLOGY Lecture 8

BMFS 3373

CNC TECHNOLOGYLecture 8

Page 2: BMFS 3373 CNC TECHNOLOGY Lecture 8

Lecture Objectives

At the end of the lecture, you will be able to: Explain what subprogram is. Understand the commands and rules for creating and

processing subprograms. Describe the advantages of subprogramming

Page 3: BMFS 3373 CNC TECHNOLOGY Lecture 8

Subprogram Concept

The programmer will often encounter a sequence of machining instructions that must be repeated, such as identical geometrical pattern at different locations

Hence causing the program to be lengthy, prone to errors and occupying more memory space in the MCU.

The best way is create a separate program, called subprogram, that contains the machining instructions for one pattern.

A main program is also created that calls the subprogram as many times as the machining sequence is repeated.

It should be noted that the subprogram & main program are separate programs that must be stored in the MCU’s memory prior to execution.

Page 4: BMFS 3373 CNC TECHNOLOGY Lecture 8

Subprogram Concept

Page 5: BMFS 3373 CNC TECHNOLOGY Lecture 8

Command for Calling a Subprogram & Returning to the Main Program

General SyntaxM98 Pn Ln

M98 : Calls for a jump to the subprogramPn : n is one to four digit number of the subprogram

in memory. The number, n, is usually preceded by the letter O (EIA) format or : (ISO) format when stored in memory

Ln : n is the number of times to repeat the call of the subprogram. If omitted, the subprogram is repeated only once

Page 6: BMFS 3373 CNC TECHNOLOGY Lecture 8

Format of the Subprogram

OXXX or :XXX

Block 1Block 2...Block nM99

M99 is the last statement in the subprogram and signals a return to the main program. The system will return to the very next statement in the main program following M98 Pn Ln command

Page 7: BMFS 3373 CNC TECHNOLOGY Lecture 8

A Main Program Accessing A Subprogram

Page 8: BMFS 3373 CNC TECHNOLOGY Lecture 8

A Main Program Accessing A Subprogram

Page 9: BMFS 3373 CNC TECHNOLOGY Lecture 8

Rules for Subprogram

One subprogram may call another subprogram (nesting). The nesting level is limited to four levels deep.

Oxxxx (EIA code) is used to indicate subprogram number. Words beginning with O and numbers range from 1 to 9999.

If ISO coding is used, a colon is entered as the address for specifying program numbers.

The mode of motion (G90 or 91) must be reset to the main program mode just prior to or just after transfer to the main program.

An active canned cycle in the main program not required in the subprogram should be canceled with G80 prior to just after transfer to the subprogram and vice versa.

If cutter diameter compensation is required in subprogram, it should be set up with G41 or 42 in the subprogram. This holds true regardless of whether diameter compensation is active in the main program.

Page 10: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example

O1000G21 G40 G17 G80T1 M06 G43 Z20. H1 S1000 M03M08 G54 X-100. Y-50.G01 Z0. F300.G172 I-180. J-80. K5. P0 Q-2 R0. X-90. Y-40. Z-5. G173 I0.2 K.3 P50 T3 S550 R85 F2000 B2000 J250 Z5 G01 Z2.G172 I180. J80. K5. P1 R0. X-90. Y-40. Z-5. G173 T3 B3500 J200 Z5 G54 X0. Y0.G01 Z10.

Page 11: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example (Cont.1)

G01 X-50. Y-50.G54 X0. Y-25.G90 G01 Z-5. M08 F500.M98 P2000 L6N10 G01 Z2. M09G54 X0. Y0. G98 G54 X0. Y-50.G90 G01 Z-5. M08 F500.M98 P2000 L6N20 G01 Z2. M09G54 X0. Y0.

Page 12: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example (Cont.2)

G98 G54 X0. Y-75.G90 G01 Z0. M08 F500.M98 P2000 L6N30 G01 Z2. M09G54 X0. Y0.G28 Z10. Y10. Z50  M30

Page 13: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example (Cont.3)

O2000G91 G54 X-25. G90 G01 Z-5. F300.G172 I-20. J-20. K5. P0 Q-1 R-5. X-10. Y-10. Z-15. G173 I0.2 K.3 P50 T3 S550 R85 F2000 B2000 J250 Z5 G01 Z2.G172 I20. J20. K5. P1 R0. X-10. Y-10. Z-15. G173 T3 B3500 J200 Z5 M99

Page 14: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example (Cont.4)

Page 15: BMFS 3373 CNC TECHNOLOGY Lecture 8

Additional Subprogram Control Features

M99 in the main program: goes to the specified block number

M99 in the subprogram with a specified block number: transfer back to the specified block number

The operator has the option directing the controller to skip the execution of selected blocks in a program by inserting a slash (/) code as the first character. (Skip switch on the machine must be turned on first)

Page 16: BMFS 3373 CNC TECHNOLOGY Lecture 8

Example of Skip Code

Page 17: BMFS 3373 CNC TECHNOLOGY Lecture 8

EndChapter 8