SlideShare a Scribd company logo
1 of 15
Macro’s Programming
Information Module
Introduction to macro’s
• What is the difference between macro and a macro
statement
• How macro’s are used
• Parameter
• G and M codes
• Settings
• Variables
• Write a basic macro’s program
Definition
• A macro is a form of sub-program that includes non-G-
code commands. It is typically a common operation that
will be called many times.
• Any program that performs a common function and will be
executed repeatedly within a g-code program.
Macro statements
• Any non-G-code command. Includes statements such
as: IF, WHILE, GOTO, math functions, and variables.
Macro Enable parameter bit
• Parameter 57 bit 22. This parameter allows for the entry
of macro statements.
• The control needs an option code to activate this
parameter.
Parameter 57 bit 22
• This parameter is used at the time of program entry not
program execution.
• If this parameter is turned off and a macro statement is
entered, the control will ignore it.
• If program is loaded from a file with the parameter off, the
macro 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.
Why use macro’s ?
• A G-code program is rigid in structure and can not be
altered in mid-operation. Offset are the only means to
adjust the machine path from one run to the next.
• Macros add flexible with the use of additional macro
statements.
• With macros you can set up families of parts, create
custom canned cycles and drive optional devices.
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
Settings that can affect macro progs
• #23 9xxx PROGS EDIT LOCK
• #74 9xxx PROGS TRACE
• #75 9xxx PROGS SINGLE BLK
Variables
• Local variables
Local variables range between #1 and #33. See the operator’s manual for
more details.
• Global variables
Global variables occur in three ranges #100 - #199, #500 - #699 and
#800 - #899. See the operator’s manual for more details.
System variables
System variables give the programmer the ability to interact with control
conditions. Note that some of these variables are read only.
See the operator’s manual for more details.
G103 P1
• Limiting the block look ahead is very important when programming
with macro’s
• Adding a G103 P1 in the program with a minimum of 4 end-of-blocks
like the example below will limit the look ahead.
O9000;
G103 P1;
;
;
;
;
(Add a G103 at the end of the macro program)
Program Syntax
• Parentheses
Parentheses are used to enclose comments.
• Brackets
Brackets are used to control the order of execution of expressions within a
g-code program and are used to enclose MACRO expressions.
• Line Numbers
Line numbers are a way of assigning a label to a block.
Line numbers can be used with sub-routine calls. Nnn indicates the target
of a M99 Pnn, M97 Pnn, or GOTOnn statement.
Aliasing a macro to a G- or M-code
• Aliasing is the act of assigning a name (G-code) to a
specific program. Macro's are typically a subprogram, not
a stand-alone program.
• They are called via G65 or M98. This subprogram call can
be replaced with a single M- or G-code.
• The assignment of this new code to a program takes place
through parameters 81-100. Only programs O9000 to
O9019 may be aliased.
• When aliased to a G-code, variables may be passed.
• With an M-code, variables may not be passed.
Parts counter macro example
O00001
G103 P1
;
;
;
;
#800= xxx (NUMBER OF PARTS)
N100
IF [ #801 GE #800 ] GOTO200
#801= #801 + 1
(ADD MAIN PROGRAM)
IF [ #801 LE #800 ] GOTO100
N200
#801= 0
M30
Prepared by Haas Automation
Training Department
Oxnard, CA 93030

More Related Content

What's hot

CNC part programming
CNC part programmingCNC part programming
CNC part programmingjntuhcej
 
Interchangeability & selective assembly
Interchangeability & selective assemblyInterchangeability & selective assembly
Interchangeability & selective assemblyKumar Chirra
 
Design for fluctuating loads
Design for fluctuating loadsDesign for fluctuating loads
Design for fluctuating loadsDr.Vikas Deulgaonkar
 
Tool changing mechanism in cnc machine
Tool changing mechanism in cnc machineTool changing mechanism in cnc machine
Tool changing mechanism in cnc machineBhaveshChaudhari21
 
Introduction to lathe machine
Introduction to lathe machine Introduction to lathe machine
Introduction to lathe machine Umair Ahmad
 
gauges, Metrology, Types of gauges
gauges, Metrology, Types of gaugesgauges, Metrology, Types of gauges
gauges, Metrology, Types of gaugesRaju D
 
Jigs and fixtures
Jigs and fixtures Jigs and fixtures
Jigs and fixtures Zohaib Ahmad
 
Design For Assembly- Machining COnsideration
Design For Assembly- Machining COnsiderationDesign For Assembly- Machining COnsideration
Design For Assembly- Machining COnsiderationaman1312
 
Shaping , slotting and planning machines
Shaping , slotting and planning machinesShaping , slotting and planning machines
Shaping , slotting and planning machinesU.M.Manikanta Demudu
 
Types of fits
Types of fitsTypes of fits
Types of fitsSinokia Lee
 
Workshop practice ii lecture notes
Workshop practice ii lecture notesWorkshop practice ii lecture notes
Workshop practice ii lecture notesIYAKAREMYE Jean De Dieu
 
CNC machining centers
CNC machining centersCNC machining centers
CNC machining centersSalman Jailani
 
BALL SCREW TECHNOLOGY
BALL SCREW TECHNOLOGYBALL SCREW TECHNOLOGY
BALL SCREW TECHNOLOGYAmit Rawat
 
Introduction to Mechanical Measurements and Metrology
Introduction to Mechanical Measurements and Metrology Introduction to Mechanical Measurements and Metrology
Introduction to Mechanical Measurements and Metrology taruian
 

What's hot (20)

Cnc milling
Cnc millingCnc milling
Cnc milling
 
CNC part programming
CNC part programmingCNC part programming
CNC part programming
 
Interchangeability & selective assembly
Interchangeability & selective assemblyInterchangeability & selective assembly
Interchangeability & selective assembly
 
cnc machining
cnc machiningcnc machining
cnc machining
 
Design for fluctuating loads
Design for fluctuating loadsDesign for fluctuating loads
Design for fluctuating loads
 
Tool changing mechanism in cnc machine
Tool changing mechanism in cnc machineTool changing mechanism in cnc machine
Tool changing mechanism in cnc machine
 
Introduction to lathe machine
Introduction to lathe machine Introduction to lathe machine
Introduction to lathe machine
 
gauges, Metrology, Types of gauges
gauges, Metrology, Types of gaugesgauges, Metrology, Types of gauges
gauges, Metrology, Types of gauges
 
Tool presetting
Tool presettingTool presetting
Tool presetting
 
Jigs and fixtures
Jigs and fixtures Jigs and fixtures
Jigs and fixtures
 
Design For Assembly- Machining COnsideration
Design For Assembly- Machining COnsiderationDesign For Assembly- Machining COnsideration
Design For Assembly- Machining COnsideration
 
Shaping , slotting and planning machines
Shaping , slotting and planning machinesShaping , slotting and planning machines
Shaping , slotting and planning machines
 
Types of fits
Types of fitsTypes of fits
Types of fits
 
Cnc lab manual
Cnc lab manualCnc lab manual
Cnc lab manual
 
Geometry of Milling cutter's and Twist drills
Geometry of Milling cutter's and Twist drillsGeometry of Milling cutter's and Twist drills
Geometry of Milling cutter's and Twist drills
 
Workshop practice ii lecture notes
Workshop practice ii lecture notesWorkshop practice ii lecture notes
Workshop practice ii lecture notes
 
CNC machining centers
CNC machining centersCNC machining centers
CNC machining centers
 
BALL SCREW TECHNOLOGY
BALL SCREW TECHNOLOGYBALL SCREW TECHNOLOGY
BALL SCREW TECHNOLOGY
 
Holding
HoldingHolding
Holding
 
Introduction to Mechanical Measurements and Metrology
Introduction to Mechanical Measurements and Metrology Introduction to Mechanical Measurements and Metrology
Introduction to Mechanical Measurements and Metrology
 

Viewers also liked

4 basic cnc programming milling
4 basic cnc programming milling4 basic cnc programming milling
4 basic cnc programming millingMahesh Namdev
 
The Pencil Parable and You.
The Pencil Parable and You. The Pencil Parable and You.
The Pencil Parable and You. Timothy Wooi
 
Keyseat Cutters - Harvey Tool
Keyseat Cutters - Harvey ToolKeyseat Cutters - Harvey Tool
Keyseat Cutters - Harvey ToolHarvey Tool Company
 
Section09 tool geometry
Section09 tool geometrySection09 tool geometry
Section09 tool geometrydschultz2012
 
Screw thread cutting internal
Screw thread cutting  internalScrew thread cutting  internal
Screw thread cutting internalRayon Johnson
 
Interviewing skills & self preparation during interview session
Interviewing skills & self preparation during interview sessionInterviewing skills & self preparation during interview session
Interviewing skills & self preparation during interview sessionTimothy Wooi
 
GD&T day 2 Training for Omega Fabrication, Melaka
GD&T day 2 Training for Omega Fabrication, MelakaGD&T day 2 Training for Omega Fabrication, Melaka
GD&T day 2 Training for Omega Fabrication, MelakaTimothy Wooi
 
Implementacion de lean manufacturing en mipymes en el valle del cauca
Implementacion de lean manufacturing en mipymes en el valle del caucaImplementacion de lean manufacturing en mipymes en el valle del cauca
Implementacion de lean manufacturing en mipymes en el valle del caucasundar sivam
 
GD&T for Omega Fabrication, Melaka.4-5th March 2017
GD&T for Omega Fabrication, Melaka.4-5th March 2017GD&T for Omega Fabrication, Melaka.4-5th March 2017
GD&T for Omega Fabrication, Melaka.4-5th March 2017Timothy Wooi
 
The innovated bike to travel 24 countries from malaysia to london
The innovated bike to travel 24 countries from malaysia to londonThe innovated bike to travel 24 countries from malaysia to london
The innovated bike to travel 24 countries from malaysia to londonTimothy Wooi
 
Thread cutting presentation
Thread cutting presentationThread cutting presentation
Thread cutting presentationRayon Johnson
 
Threads and thread_cutting
Threads and thread_cuttingThreads and thread_cutting
Threads and thread_cuttingVJTI Production
 
CNC Milling
CNC MillingCNC Milling
CNC Millingendika55
 
Geometrical Dimensioning & Tolerancing
Geometrical Dimensioning & TolerancingGeometrical Dimensioning & Tolerancing
Geometrical Dimensioning & TolerancingHassan Habib
 

Viewers also liked (20)

Macro -fanuc
Macro -fanucMacro -fanuc
Macro -fanuc
 
4 basic cnc programming milling
4 basic cnc programming milling4 basic cnc programming milling
4 basic cnc programming milling
 
DXF Import & Programming
DXF Import & ProgrammingDXF Import & Programming
DXF Import & Programming
 
The Pencil Parable and You.
The Pencil Parable and You. The Pencil Parable and You.
The Pencil Parable and You.
 
Drills, Reamers & More
Drills, Reamers & MoreDrills, Reamers & More
Drills, Reamers & More
 
Threadmill cutters
Threadmill cuttersThreadmill cutters
Threadmill cutters
 
Keyseat Cutters - Harvey Tool
Keyseat Cutters - Harvey ToolKeyseat Cutters - Harvey Tool
Keyseat Cutters - Harvey Tool
 
Section09 tool geometry
Section09 tool geometrySection09 tool geometry
Section09 tool geometry
 
Screw thread cutting internal
Screw thread cutting  internalScrew thread cutting  internal
Screw thread cutting internal
 
Interviewing skills & self preparation during interview session
Interviewing skills & self preparation during interview sessionInterviewing skills & self preparation during interview session
Interviewing skills & self preparation during interview session
 
GD&T day 2 Training for Omega Fabrication, Melaka
GD&T day 2 Training for Omega Fabrication, MelakaGD&T day 2 Training for Omega Fabrication, Melaka
GD&T day 2 Training for Omega Fabrication, Melaka
 
Implementacion de lean manufacturing en mipymes en el valle del cauca
Implementacion de lean manufacturing en mipymes en el valle del caucaImplementacion de lean manufacturing en mipymes en el valle del cauca
Implementacion de lean manufacturing en mipymes en el valle del cauca
 
GD&T for Omega Fabrication, Melaka.4-5th March 2017
GD&T for Omega Fabrication, Melaka.4-5th March 2017GD&T for Omega Fabrication, Melaka.4-5th March 2017
GD&T for Omega Fabrication, Melaka.4-5th March 2017
 
The innovated bike to travel 24 countries from malaysia to london
The innovated bike to travel 24 countries from malaysia to londonThe innovated bike to travel 24 countries from malaysia to london
The innovated bike to travel 24 countries from malaysia to london
 
Thread cutting presentation
Thread cutting presentationThread cutting presentation
Thread cutting presentation
 
5 g-code
5   g-code5   g-code
5 g-code
 
Threading - MMM
Threading - MMMThreading - MMM
Threading - MMM
 
Threads and thread_cutting
Threads and thread_cuttingThreads and thread_cutting
Threads and thread_cutting
 
CNC Milling
CNC MillingCNC Milling
CNC Milling
 
Geometrical Dimensioning & Tolerancing
Geometrical Dimensioning & TolerancingGeometrical Dimensioning & Tolerancing
Geometrical Dimensioning & Tolerancing
 

Similar to Macro Programming

Modularisation techniques new
Modularisation techniques newModularisation techniques new
Modularisation techniques newJeet Thombare
 
Module 5.pdf
Module 5.pdfModule 5.pdf
Module 5.pdfSE14Darshan
 
Mach4 mill-g code-manual
Mach4 mill-g code-manualMach4 mill-g code-manual
Mach4 mill-g code-manualEng-Ibrahim Tamimi
 
Fadal programming and machine operation - formats manual
Fadal programming and machine operation - formats manualFadal programming and machine operation - formats manual
Fadal programming and machine operation - formats manualIndependent Technology Service Inc
 
GENERATOR BASED REUSE.pptx
GENERATOR BASED REUSE.pptxGENERATOR BASED REUSE.pptx
GENERATOR BASED REUSE.pptxSyedKhaleelahmed6
 
A Review on Parametric Programming Techniques Utilized For Advanced CNC Machines
A Review on Parametric Programming Techniques Utilized For Advanced CNC MachinesA Review on Parametric Programming Techniques Utilized For Advanced CNC Machines
A Review on Parametric Programming Techniques Utilized For Advanced CNC Machinesijsrd.com
 
Webinar: Best Practices for Migrating to Magnolia 5
Webinar: Best Practices for Migrating to Magnolia 5Webinar: Best Practices for Migrating to Magnolia 5
Webinar: Best Practices for Migrating to Magnolia 5Magnolia
 
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...Michael Patterson
 
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdfMiguelAngelMacas1
 
Dynamic debugging in 8085 microprocessor
Dynamic debugging in 8085 microprocessorDynamic debugging in 8085 microprocessor
Dynamic debugging in 8085 microprocessorRamaPrabha24
 

Similar to Macro Programming (20)

Macro
MacroMacro
Macro
 
Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
Modularisation techniques new
Modularisation techniques newModularisation techniques new
Modularisation techniques new
 
Module 5.pdf
Module 5.pdfModule 5.pdf
Module 5.pdf
 
Mach4 mill-g code-manual
Mach4 mill-g code-manualMach4 mill-g code-manual
Mach4 mill-g code-manual
 
Modular programming
Modular programmingModular programming
Modular programming
 
CADM4.pptx
CADM4.pptxCADM4.pptx
CADM4.pptx
 
Fadal programming and machine operation - formats manual
Fadal programming and machine operation - formats manualFadal programming and machine operation - formats manual
Fadal programming and machine operation - formats manual
 
G AND M
G AND MG AND M
G AND M
 
GENERATOR BASED REUSE.pptx
GENERATOR BASED REUSE.pptxGENERATOR BASED REUSE.pptx
GENERATOR BASED REUSE.pptx
 
Coding
CodingCoding
Coding
 
A Review on Parametric Programming Techniques Utilized For Advanced CNC Machines
A Review on Parametric Programming Techniques Utilized For Advanced CNC MachinesA Review on Parametric Programming Techniques Utilized For Advanced CNC Machines
A Review on Parametric Programming Techniques Utilized For Advanced CNC Machines
 
Sub-programs
Sub-programsSub-programs
Sub-programs
 
J1939 PDF | J1939 Stack Handbook | Manual Guide
J1939 PDF | J1939 Stack Handbook | Manual GuideJ1939 PDF | J1939 Stack Handbook | Manual Guide
J1939 PDF | J1939 Stack Handbook | Manual Guide
 
Webinar: Best Practices for Migrating to Magnolia 5
Webinar: Best Practices for Migrating to Magnolia 5Webinar: Best Practices for Migrating to Magnolia 5
Webinar: Best Practices for Migrating to Magnolia 5
 
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...
Parallelization and Optimization of Time-Domain Electronic Scattering Simulat...
 
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf
21E-WhatsTheFuss_UsingProceduresAndServicePrograms.pdf
 
Me3m02 expt p3
Me3m02 expt p3Me3m02 expt p3
Me3m02 expt p3
 
Dynamic debugging in 8085 microprocessor
Dynamic debugging in 8085 microprocessorDynamic debugging in 8085 microprocessor
Dynamic debugging in 8085 microprocessor
 
Macro-processor
Macro-processorMacro-processor
Macro-processor
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 

Macro Programming

  • 2. Introduction to macro’s • What is the difference between macro and a macro statement • 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 that will be called many times. • Any program that performs a common function and will be executed repeatedly within a g-code program.
  • 4. Macro statements • Any non-G-code command. Includes statements such as: IF, WHILE, GOTO, math functions, and variables.
  • 5. Macro Enable parameter bit • Parameter 57 bit 22. This parameter allows for the entry of macro statements. • The control needs an option code to activate this parameter.
  • 6. Parameter 57 bit 22 • This parameter is used at the time of program entry not program execution. • If this parameter is turned off and a macro statement is entered, the control will ignore it. • If program is loaded from a file with the parameter off, the macro 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 be altered in mid-operation. Offset are the only means to adjust the machine path from one run to the next. • Macros add flexible with the use of additional macro statements. • With macros you can set up families of parts, create custom 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 variables Local variables range between #1 and #33. See the operator’s manual for more details. • Global variables Global variables occur in three ranges #100 - #199, #500 - #699 and #800 - #899. See the operator’s manual for more details. System variables System variables give the programmer the ability to interact with control conditions. 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 programming with macro’s • Adding a G103 P1 in the program with a minimum of 4 end-of-blocks like the example below will limit the look ahead. O9000; G103 P1; ; ; ; ; (Add a G103 at the end of the macro program)
  • 12. Program Syntax • Parentheses Parentheses are used to enclose comments. • Brackets Brackets are used to control the order of execution of expressions within a g-code program and are used to enclose MACRO expressions. • Line Numbers Line numbers are a way of assigning a label to a block. Line numbers can be used with sub-routine calls. Nnn indicates the target of 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 a specific program. Macro's are typically a subprogram, not a stand-alone program. • They are called via G65 or M98. This subprogram call can be replaced with a single M- or G-code. • The assignment of this new code to a program takes place through parameters 81-100. Only programs O9000 to O9019 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 example O00001 G103 P1 ; ; ; ; #800= xxx (NUMBER OF PARTS) N100 IF [ #801 GE #800 ] GOTO200 #801= #801 + 1 (ADD MAIN PROGRAM) IF [ #801 LE #800 ] GOTO100 N200 #801= 0 M30
  • 15. Prepared by Haas Automation Training Department Oxnard, CA 93030