Hello Guest it is March 28, 2024, 11:05:15 AM

Author Topic: Relay control Mcode  (Read 1988 times)

0 Members and 1 Guest are viewing this topic.

Relay control Mcode
« on: August 05, 2016, 06:12:54 AM »
Kindly tell in Mach4 which Mcode operate the internal relay and multiple external relay in Motion Controller or BOB.
Re: Relay control Mcode
« Reply #1 on: August 05, 2016, 05:53:48 PM »
That depends on your motion controller and break-out board.  In general, you have to map one or more Mach4 output signals to the pins on your motion controller/BOB that control the relays.  For example, on the PMDX SmartBOB products, some of them have "Pin1" control the on-board relay, and some have a separate output pin named "Relay".  If you were using a PMDX-411 connected to a PMDX-126, the two relays on the PMDX-126 are controlled by "Pin1" and "Pin14".

To see the Mach4 output signals, go the "Configure" menu and select "Mach...".  Then click on the "Output Signals" tab.

M3 turns on the "Spindle On" and "Spindle Fwd" Mach4 outputs and turns off the "Spindle Rev" output
M4 turns on the "Spindle On" and "Spindle Rev" outputs, and turns off the "Spindle Fwd" output
M5 turns off the "Spindle On", "Spindle Fwd" and "Spindle Rev" outputs

M7 turns on the "Mist On" output
M8 turns on the "Coolant On" output (also sometimes referred to as "Flood On")
M9 turns off both "Mist On" and "Coolant On" outputs

You can write custom M codes to control the Mach4 "Output #0" through "Output #31" outputs.  There are messages elsewhere on this forum that discuss that.  You can also look in the Mach4Hobby/Docs directory for the "ScriptingManual.pdf" which in section 3.1.1 tells you which M codes are available for custom code (i.e. "scriptable").

Bob