Presentation is loading. Please wait.

Presentation is loading. Please wait.

Subprograms Mach 153B John Branlund.

Similar presentations


Presentation on theme: "Subprograms Mach 153B John Branlund."— Presentation transcript:

1 Subprograms Mach 153B John Branlund

2 Learning objectives Learn basic pattern recognition.
Make a common feature the key or index. Make a block diagram to show program flow. Formulate the contents of the sub.

3 In this example … We have a job that needs 12 holes to mount three parts on a plate (4x for each part). Each hole will be: Spot Drilled Ruff drilled Reamed

4 Normal program is 62 lines
(1st numbers on a line are line numbers and not normal programming)

5 Possible subprogram advantages
Shorter program (less typing). Less math figuring the ABS coordinates for each hole. Easier to move the mounting pattern if design is modified. Program could potentially be reused for similar patterns. Program could be converted to a macro (G65), for all four hole patterns (we will do that later).

6 Starting - Looking for patterns
Let’s say we are programming these 12 holes. Locate a pattern. Pick a index or key feature.

7 Visualize the sub’s action
Each time: Hole #1 Hole #2 Hole #3 Hole #4 Return to main.

8 Each cycle will… Watch the graphic.
Remember, holes will be made at each X & Y move. Oops … this will do Hole #1 twice. We need to remove hole 1 from the sub.

9 Fixed Sub … Watch this graphic of the subroutine:

10 Block Diagram Block diagrams are a valuable aid.
But if you draw in all the calls they can become very confusing.

11 Simplified Block Diagram
Make a diagram of just 1 tool to simplify the diagram.

12 Writing the G-Code Decide on sub type.
Global (M98) if sub will be used by more than one part program. Local (M97) used by only the one program. This is simpler for the operator. Let’s use local for this sample.

13 Write Sub 1st Using my original program, I put the sub after the M30, for the Haas control. Local sub must have a unique N number. Hole locations would be incremental distances from the blueprint. Be sure to return to Absolute Coordinates.

14 Edit Spot Drill Then I edited the Spot Drill portion of my program.
Notice I put a G90 on each line that I want Absolute Coordinates uses – this is to prevent problems.

15 Edit Ruff Drill Then I edited the Ruff Drill portion of my program.
Notice I started with the last pattern from the spot drill.

16 Edit Reamer Then I edited the Ruff Drill portion of my program.

17 Program Using Subs 52 lines
(1st numbers on a line are line numbers and not normal programming)

18 Going further … You may have noticed a pattern in the subroutine program, if we did not change the order. Subroutines can call other subroutines. This is called ‘Nesting’. Most controls will nest to nine levels deep.

19 Advantages / Disadvantages
Still shorter program. Even easier to move the pattern if the design is changed. More complex – harder for operators to understand. Tougher to resume program after unplanned stop. Rapid moves not as efficient at tool changes.

20 Nesting Block Diagram Column 1 is Main Program. Column 2 is Sub 1.
Each tool calls Sub 1 once. Each pattern calls Sub 2.

21 Write subs 1st As before, write the subroutines first.

22 Edit the Main Program For each tool: G54 to Pattern 1 Hole 1 location.
Activate cycle (NO X or Y values). Call Sub 1. Cancel Cycle.

23 Nested program is 51 lines
(1st numbers on a line are line numbers and not normal programming)

24 Additional …. Patterns with lines of holes can use a cycle with a ‘L’ word. Subroutine format varies between controls. Study the programming manual for your control to see which format / codes are used.


Download ppt "Subprograms Mach 153B John Branlund."

Similar presentations


Ads by Google