Your SlideShare is downloading. ×
0
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Macro Programming
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Macro Programming

2,404

Published on

Introduction to macros

Introduction to macros

Published in: Education, Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,404
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Macro’s ProgrammingInformation Module
  • 2. Introduction to macro’s• What is the difference between macro and a macrostatement• How macro’s are used• Parameter• G and M codes• Settings• Variables• Write a basic macro’s program
  • 3. Definition• A macro is a form of sub-program that includes non-G-code commands. It is typically a common operation thatwill be called many times.• Any program that performs a common function and will beexecuted repeatedly within a g-code program.
  • 4. Macro statements• Any non-G-code command. Includes statements suchas: IF, WHILE, GOTO, math functions, and variables.
  • 5. Macro Enable parameter bit• Parameter 57 bit 22. This parameter allows for the entryof macro statements.• The control needs an option code to activate thisparameter.
  • 6. Parameter 57 bit 22• This parameter is used at the time of program entry notprogram execution.• If this parameter is turned off and a macro statement isentered, the control will ignore it.• If program is loaded from a file with the parameter off, themacro statements will be converted to comments.• If the statement is loaded manually in MDI or edit modes,the control will give an alarm when the parameter is off.
  • 7. Why use macro’s ?• A G-code program is rigid in structure and can not bealtered in mid-operation. Offset are the only means toadjust the machine path from one run to the next.• Macros add flexible with the use of additional macrostatements.• With macros you can set up families of parts, createcustom canned cycles and drive optional devices.
  • 8. Useful G and M codes• M01 Optional Program stop• M00 Program stop• M30 Program end and reset• G04 Dwell• G65 Pxx Macro sub program call• M97 Pxx Local sub program call• M98 Pxx Sub program call• G103 P1 Block look ahead limit• M109 Interactive user input
  • 9. Settings that can affect macro progs• #23 9xxx PROGS EDIT LOCK• #74 9xxx PROGS TRACE• #75 9xxx PROGS SINGLE BLK
  • 10. Variables• Local variablesLocal variables range between #1 and #33. See the operator’s manual formore details.• Global variablesGlobal variables occur in three ranges #100 - #199, #500 - #699 and#800 - #899. See the operator’s manual for more details.System variablesSystem variables give the programmer the ability to interact with controlconditions. Note that some of these variables are read only.See the operator’s manual for more details.
  • 11. G103 P1• Limiting the block look ahead is very important when programmingwith macro’s• Adding a G103 P1 in the program with a minimum of 4 end-of-blockslike the example below will limit the look ahead.O9000;G103 P1;;;;;(Add a G103 at the end of the macro program)
  • 12. Program Syntax• ParenthesesParentheses are used to enclose comments.• BracketsBrackets are used to control the order of execution of expressions within ag-code program and are used to enclose MACRO expressions.• Line NumbersLine numbers are a way of assigning a label to a block.Line numbers can be used with sub-routine calls. Nnn indicates the targetof a M99 Pnn, M97 Pnn, or GOTOnn statement.
  • 13. Aliasing a macro to a G- or M-code• Aliasing is the act of assigning a name (G-code) to aspecific program. Macros are typically a subprogram, nota stand-alone program.• They are called via G65 or M98. This subprogram call canbe replaced with a single M- or G-code.• The assignment of this new code to a program takes placethrough parameters 81-100. Only programs O9000 toO9019 may be aliased.• When aliased to a G-code, variables may be passed.• With an M-code, variables may not be passed.
  • 14. Parts counter macro exampleO00001G103 P1;;;;#800= xxx (NUMBER OF PARTS)N100IF [ #801 GE #800 ] GOTO200#801= #801 + 1(ADD MAIN PROGRAM)IF [ #801 LE #800 ] GOTO100N200#801= 0M30
  • 15. Prepared by Haas AutomationTraining DepartmentOxnard, CA 93030

×