Video 2 in our Macro B Programming series. This video looks at passing values to a macro that control the resulting tool motion.

In part 2 of our Macro B programming series, we'll have a look at the use of passing values to a macro program.

Macro programs can be used much the same as a subprogram would. The main difference being that with a macro subprogram call you can pass information for the macro to use.

In the sample video we are looking to apply this variable passing technique with a drilling subprogram. The aim is to create a custom drilling cycle, one that will enter into a pre-drilled hole at a reduced feedrate, drill at the full feedrate, and then breakthrough the bottom of the part at a reduced feedrate.

When passing variables from the main program to the sub with a macro call, it is recommended to refer to your machines programming manual to ensure you are passing values into the correct variable. eg. does A = Variable #1, B = Variable #2 etc.

The main difference between a subprogram call and a macro call is the gcode used. Subprograms use an M98 followed by a P word that represents the program number of the subprogram. A macro call uses G67 followed by a P word that represents the program number of the macro program. The G67 line of code can also include A,B,C, etc which are used to pass values to the program being called. Both the subprogram and macro being called must end with an M99 to send it back to the main program that called it.

If you missed out on the first video in this series, here is a link to that posting here...

Macro B Programming 1

Want to learn more about Mastercam? Check out;

camInstructor for Teachers - Independent Learners - Students