(Part A) Machinerys Handbook 31st Edition Pages 1-1484

CNC SUBROUTINES AND MACROS Machinery's Handbook, 31st Edition

1379

a) Understanding various methods of data settings b) CNC machines and controls—operation and programming c) Machining skills—how to machine a part d) Basic mathematics skills—calculations, formulas e) Program structure development skills—convenience and consistency f) Offsets and compensations applications skills—various adjustments g) Fixed cycles in depth—how they work, in detail h) Subprograms in depth, including multi nesting applications i) System parameters, their purpose and functions

In addition, if a macro is written for a particular function of the machine, knowledge of that function as it relates to the machine is also very important. If the macro is developed for probing or in-process gauging, the programmer has to understand the full process as well as the objective of the macro development. Confirming Macro Capability.— A macro is a control option, and may not be automati­ cally available to the user. There is a simple way to find out if a macro is active. Set the control to MDI mode (Manual Data Input) and enter this command: #1=1 After pressing the “Cycle Start” button, the control will either accept the statement or reject it. The # symbol identifies the subsequent number as a variable number 1 with an assigned value of 1. A statement using the # symbol is unique to macros. If the control rejects it, or it is impossible to enter the symbols, that means the control does not support macro functions. Common Features and Applications.— Typical features found in macros are: 1) Arithmetic and algebraic calculations 2) Trigonometric calculations 3) Variable data storage 4) Logical operations 5) Branching 6) Looping 7) Error detection A macro program looks like a regular CNC program, but includes many other features. A macro program is structured as a subprogram—it is stored under its own program number (O-), and it is usually called by the main program, using the G65 preparatory command. In a simple form, macro features can be used in the main program, without the macro call. The following list highlights some of the most common applications of macros: 1) Groups of similar parts (parametric programming) 8) Alarm generation 9) Input and Output 10) Miscellaneous features

2) Offset control 3) Custom cycles 4) Non-standard tool motions (simulating curves) 5) Special G-codes and M-codes 6) Alarm and message generation 7) Hiding and protecting macro programs 8) Probing and gauging 9) Various shortcuts and utilities

Macro Structure.— There are three basic areas to understand for successful macro devel­ opment. These three areas offer many special functions that are used within the macro. Variables are the key element of all macros. They provide flexibility by easily storing changeable data. When a value is assigned to a variable, it is stored for future use. Stored values are called Defined Variables .

Copyright 2020, Industrial Press, Inc.

ebooks.industrialpress.com

Made with FlippingBook - Share PDF online