SB CG1/M-Commands

From wiki.fablabtoscana.it
GCode programming
modifica
Introduction

M-codes are Non-Axis movement command and also called as machine codes which control the miscellaneous functions of machine excluding the axis movement of the machines.

M-Code is the Letter “M” followed by the Numbers which control the machine functions. Example: M03 controls the spindle to rotate along clockwise direction.

  • M-code can be used to initiate a miscellaneous function not related to tool movement.
  • M-code Usually acts like a switches that stay ON until they are turned OFF by another M code
  • M-code is always allowed one per block of code.
  • Some M-codes are used in conjunction with other address, M06 tool change is always called with the conjunction with a T word.
  • The machine tool manufacturer often provides many additional M-Codes, many of these codes are non-standard, and therefore we should consult the user manual of machine before making assumptions while using M-codes in the CNC program.


M Code Modal Groups:

  • Group 2 = [M26, M27} - axis clamping
  • Group 4 = [M0, M1, M2, M30, M60] - stopping
  • Group 6 = [M6] - tool change
  • Group 7 = [M3, M4, M5] - spindle turning
  • Group 8 = [M7, M8, M9] - coolant
  • Group 9 = [M48, M49] - feed and speed override bypass


M0, M1 Program Pause

  • M0 - pause a running program temporarily. LinuxCNC remains in the Auto Mode so MDI and other manual actions are not enabled. Pressing the cycle start button will restart the program at the following line.
  • M1 - pause a running program temporarily if the optional stop switch is on. LinuxCNC remains in the Auto Mode so MDI and other manual actions are not enabled. Pressing the cycle start button will restart the program at the following line.

M2, M30 Program End

  • M2 - end the program. Pressing cycle start will start the program at the beginning of the file.
  • M30 - exchange pallet shuttles and end the program. Pressing cycle start will start the program at the beginning of the file.


Both of these commands have the following effects:

  • Change from Auto mode to MDI mode.
  • Origin offsets are set to the default (like G54).
  • Selected plane is set to XY plane (like G17).
  • Distance mode is set to absolute mode (like G90).
  • Feed rate mode is set to units per minute (like G94).
  • Feed and speed overrides are set to ON (like M48).
  • Cutter compensation is turned off (like G40).
  • The spindle is stopped (like M5).
  • The current motion mode is set to feed (like G1).
  • Coolant is turned off (like M9).


M3, M4, M5 Spindle Control

  • M3 - start the spindle clockwise at the S speed.
  • M4 - start the spindle counterclockwise at the S speed.
  • M5 - stop the spindle.


M6 Tool Change

6.1. Manual Tool Change If the HAL component hal_manualtoolchange is loaded, M6 will stop the spindle and prompt the user to change the tool based on the last T- number programmed. For more information on hal_manualtoolchange see the Manual Tool Change section.

6.2. Tool Changer To change a tool in the spindle from the tool currently in the spindle to the tool most recently selected (using a T word), program M6.

When the tool change is complete:

  • The spindle will be stopped.
  • The tool that was selected (by a T word on the same line or on any line after the previous tool change) will be in the spindle.
  • If the selected tool was not in the spindle before the tool change, the tool that was in the spindle (if there was one) will be placed back into the tool changer magazine.
  • If configured in the .ini file some axis positions may move when a M6 is issued. See the EMCIO section for more information on tool change options.
  • No other changes will be made. For example, coolant will continue to flow during the tool change unless it has been turned off by an M9.

Warning:

The tool length offset is not changed by M6, use G43 after the M6 to change the tool length offset.



M7, M8, M9 Coolant Control

  • M7 - turn mist coolant on.
  • M8 - turn flood coolant on.
  • M9 - turn all coolant off.

It is OK to use any of these commands, regardless of the current coolant state.