İçeriğe geç
İletişim Başlayın

User M Codes

Bu içerik henüz dilinizde mevcut değil.

A machine does things no program should have to spell out: change a tool, open a cover, clamp a fixture, index a table. Those belong in one place, written once, called by a single word.

An M code can be bound to a subprogram. When a program uses that M code, the control runs the subprogram instead. That includes the tool change that ships with the machine, which is bound this way rather than built in.

There are ten slots. Each is a parameter holding an M number, and each has a subprogram fixed to it:

Write the M number intoand it calls
#6080O9020
#6081O9021
#6089O9029

So #6080 = 6 makes M06 run O9020. That is exactly how the tool change arrives: the machine ships with that parameter set and the tool-change macro in O9020.

The parameters are set on the PARAMETERS screen, and they are retained, so a binding survives a power cycle.

The bound subprogram is called the way G65 calls a macro, so the words on the block arrive as local variables:

On the blockArrives as
T#20
S#19
F#9
D / H#7 / #11, as written; a decimal is not truncated
Q#17
R#18
X Y Z#24 #25 #26

T is modal for this call. A program that says T2 in one block and M06 in the next still reaches the subprogram with #20 holding 2. Without that, a tool-change macro would index its pocket table with nothing.

Everything else about the subprogram is ordinary macro programming: see Custom Macros for variables, conditionals and how a macro raises an alarm.

A bound M code is not run while a block search scans the program. The M code is stored with the rest of the modal state and fires when the program restarts.

That is what you want: a search moves nothing, and expanding a tool change during the scan would run the whole sequence for a program that has not started. It also means the tool the search leaves you in is the one the restart will fetch; see Block Search.

  • It replaces the built-in meaning rather than sitting beside it. The binding is checked before the control’s own handling of that M code, so binding a number the control already uses takes that number over. Bind M03 and the block no longer starts the spindle; it runs your subprogram. Choose a number the machine does not already use, unless replacing it is the point.
  • It does not carry the machine’s logic. Outputs, interlocks and waiting for a signal belong to the PLC, and the macro asks for them. See PLC Signals in Macros.