1 / 17

BMFS 3373 CNC TECHNOLOGY Lecture 8

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.

serge
Télécharger la présentation

BMFS 3373 CNC TECHNOLOGY Lecture 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BMFS 3373CNC TECHNOLOGYLecture 8

  2. 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

  3. 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.

  4. Subprogram Concept

  5. Command for Calling a Subprogram & Returning to the Main Program General Syntax M98 PnLn M98 : Calls for a jump to the subprogram Pn : 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

  6. Format of the Subprogram OXXX or :XXX Block 1 Block 2 . . . Block n M99 • 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 PnLn command

  7. A Main Program Accessing A Subprogram

  8. A Main Program Accessing A Subprogram

  9. 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.

  10. Example O1000 G21 G40 G17 G80 T1 M06 G43 Z20. H1 S1000 M03 M08 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.

  11. Example (Cont.1) G01 X-50. Y-50. G54 X0. Y-25. G90 G01 Z-5. M08 F500. M98 P2000 L6 N10 G01 Z2. M09 G54 X0. Y0. G98 G54 X0. Y-50. G90 G01 Z-5. M08 F500. M98 P2000 L6 N20 G01 Z2. M09 G54 X0. Y0.

  12. Example (Cont.2) G98 G54 X0. Y-75. G90 G01 Z0. M08 F500. M98 P2000 L6 N30 G01 Z2. M09 G54 X0. Y0. G28 Z10. Y10. Z50 M30

  13. Example (Cont.3) O2000 G91 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

  14. Example (Cont.4)

  15. 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)

  16. Example of Skip Code

  17. End Chapter 8

More Related