Quantcast
Channel: MTB Tech Blog
Viewing all articles
Browse latest Browse all 27

SIEMENS 840D - Creating Custom M-Codes

$
0
0
Many times in the course of manufacturing, it is common to find that there are many tasks that can be simplified and/or automated. On those machine tools with the SIEMENS 840D sl, users have the option to create both Custom M-Codes and Custom Cycles

Both Custom M-codes and Custom Cycles have a common element. They are both driven by an underlying sub-program file (*.SPF). Custom M-Codes and Cycles commissioned by a Machine Tool Builder will be located in the'Cycles' area under 'Manufacturer cycles'. Custom M-Codes and Cycles written by the end-user of the machine tool should be placed in in the 'Cycles' area under 'User cycles'.

The 'Cycles' area under 'NC Data' has a specific hierarchy with a specific priority. When a Custom M-Code is called from within another program, the SIEMENS system will first search the 'User cycles' area for the program. If it is not found it will then search the 'Manufacturer cycles' area and finally the 'Standard cycles' area. The 'Standard cycles' area is everything that is native to the core SIEMENS NC system. This data is 'protected' meaning that any Cycle SPF files deleted will automatically be recreated by the system. Users should leave this area alone.


The first task in creating the Custom M-Code is writing the underlying macro program for the M-Code. In this case we'll create a custom M-Code that will perform a safe reference return for a 5-Axis CNC Mill. We start by creating a new SPF program in the 'User cycles' area. We'll call this program PROG_M280 for our custom M-Code, M280.

The naming of Custom Cycle Programs and Custom M-Code Programs is important. Like all other Sub-Programs, the name may NOT start with a number. Furthermore, the first two characters in the name must be an Alpha Character or an Underscore ( _ ).



Once the editor window has opened, we then type in our program. There is an important requirement for a program that will be used for a Custom M-Code. The first line that will be executed must be the procedure declaration. In our example we will type PROC PROG_M280 DISPLOF on the declaration line. The command DISPLOF will keep the code in the program from being displayed during execution. Once we have completed the program, we then close the editor.


The next step we must take is to alias our program to the M-Code we wish to use. To do so we must navigate to the UMAC definition file under 'NC Data | Definitions'. Please note that if the UMAC definition file doesn't exist you may need to create it. We will need to open this file in the editor and add the necessary command to alias the program to the desired M-Code.


We add the code 'DEFINE M280 AS PROG_M280' on its own line.


We then close the file in the editor. The system will then prompt us to activate the definitions in the UMAC definition file. The user should click on the 'OK' softkey. Once the activation is completed successfully, the system will generate a message to that effect and our new M-Code is available to be used in a program or MDI.



You need Flash Player in order to view this.
M280 - Custom Reference Return M-Code for SIEMENS 840D sl
Execution of M280 - Custom Reference Return M-Code for SIEMENS 840D sl

In an upcoming article we'll show the method for creating a basic Custom Cycle.


Viewing all articles
Browse latest Browse all 27

Trending Articles