Saturday, April 11, 2015

Create a custom M code

,anufacturing engineering


Why would you want to make a custom M code you ask? Consider the fact you do not like the implementation of G81 on your machine or if you have tried using FANUC’s tool life management system… I’m sure you have found it to be in -adequate. These are just a couple of examples but the possibilities are endless and the benefits can be very rewarding as I will show with my example in a post to follow, “Preempting a common “C” axis error on CVTL’s. For now, lets work on the implementation of a custom “M” code specific to FANUC controls. 
All G-codes and M-codes call a macro  program that is specific to that M or G code number. The machine parameters are the controlling factor in which macro gets called although; you can call your custom code any number you like as long as it is not already in use. I’m going to use M225. After implementation, any time M225 is encountered in a G code program the macro we assign to it will be executed.
First off, we need to tell the controls that it is OK fore us to add custom code and open up the parameters for editing. To do this you will need to put the machine in MDI mode and navigate to the Offset settings screen and turn on Parameter Write Enable. Immediately you will get an alarm but, this is normal and it will stay on the screen until you disable PWE at the end of this exercise.
I am using the parameter manual from the 32i controls. Please double check that you machine’s parameter number association is the same before proceeding. This information can be found in the custom macro section of you users manual. You should finds a table similar to the following:
Program Number
Parameter Number
O9020
6080
O9021
6081
O9022
6082
O9023
6083
O9024
6084
O9025
6085
O9026
6086
O9027
6087
O9028
6088
O9029
6089

This table is the correlation between the custom M code number that you make up and the corresponding custom macro that will be called. So if I go to the folder with the 9000 level programs in it and see that there is no program called O9020 then I can create one and insert my BASIC code there then, save the program. You may enter a simple test program that does something very simple like turn the spindle on and makes a short move on the X-axis.
Now, to create my custom number I refer to the table and see that program O9020 is governed by parameter 6080. Therefore I will input the number 225 in this parameter.
That’s pretty much it. You should now turn off Parameter write enable from MDI mode, reset the alarm and restart your machine. When the controls come back up test your M code by inputting it on a single line on the MDI screen and execute.. After you see that the M call is working properly go back to the O9020 program and enter your useful code.

No comments:

Post a Comment