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.
The binding
Section titled “The binding”There are ten slots. Each is a parameter holding an M number, and each has a subprogram fixed to it:
| Write the M number into | and it calls |
|---|---|
#6080 | O9020 |
#6081 | O9021 |
| … | … |
#6089 | O9029 |
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.
Writing the subprogram
Section titled “Writing the subprogram”The bound subprogram is called the way G65 calls a macro, so the words on the block
arrive as local variables:
| On the block | Arrives 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.
During a block search
Section titled “During a block search”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.
What this does not do
Section titled “What this does not do”- 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
M03and 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.
Where to go next
Section titled “Where to go next”- Custom Macros: the language the bound subprogram is written in.
- PLC Signals in Macros: how the sequence talks to the machine.