As pointed out in the G code primer of this issue, machine tool builders vary when it comes to M code numbering. If you have similar machines with different M codes, it can be frustrating to maintain two different sets of programs – one for each machine – just because of these M code differences.
The technique we offer will not require any changes to your current programs. Consider, for example, two similar turning centers. One requires M23 and M25 to specify low and high spindle range while the other requires M41 and M42. With our recommended method, you’ll simply pick the method that you like the most (say M41 and M42). From now on, simply write all programs using these M codes.
For each machine, you’ll add in two short and simple custom macro programs (this technique does require custom macro B to be equipped on the machine). For the machine using M23 and M25, here are the two programs:
For the machine that uses M41 and M42, here are the two programs:
The trick to making this work is to change two parameters (shown in the Parameter Preference article included in this issue of The Optional Stop) in such a way that – for the machine that uses M23 and M25 – when the machine reads an M41, it will execute program O9001. When it reads and M42, it will execute program O9002.
In similar fashion, for the machine that uses M41 and M42, you’ll change the parameters so that when the machine reads an M23, it executes program O9001. When it reads M25, it executes program O9002.
From this point on, existing programs can be loaded into either machine and will select the appropriate spindle ranges.