PMDX Forum

General Category => Parallel Port breakout boards, motherboards, and dedicated accessories => Topic started by: andy_con on April 16, 2015, 06:56:42 PM

Title: M3 and M4 control help
Post by: andy_con on April 16, 2015, 06:56:42 PM
I need to reverse the spindle motor. CNC is wired to have 1 relay to start spindle and another relay to reverse the spindle.

M3 needs one relay to be on

M4 needs both relays to be on.

i need a way to turn on both relays from Mach3 using a Macro for M3/M4

thanks
Title: Re: M3 and M4 control help
Post by: Steve Stallings on April 16, 2015, 07:51:51 PM
The stock M4 macro looks like this:

///////////beginning of M4 macro code//////////////////
DoSpinCCW()
///////////end of macro code////////////////////

Do not put the lines with /////////// into the macro file. Macro files
are in your C:Mach3Macrosmy-profile-name  folder with names
like "m3m1s".

You could use the relay output normally assigned as FWD to be
your Run relay, and assign another Output to be the direction
reversal relay. For example:

////////////beginning of M4 macro code////////////////
DoSpinCW() 'Note - we used the CW relay as a Run relay instead of being a FWD relay
ActivateSignal(OUTPUT2) ? Turn on Reversing relay also, be sure to map Output2 to the pin that controls that relay
////////////end of macro code////////////////

Your M3 macro would not need to change.

Your M5 macro would now need to look something like this:

////////////beginning of M5 macro code////////////////
DoSpinStop() 'Note - we used the CW relay as a Run relay instead of being a FWD relay
DeactivateSignal(OUTPUT2) ? Turn off Reversing relay also, be sure to map Output2 to the pin that controls that relay
////////////end of macro code////////////////

The Mach3 macro programming manual can be downloaded here:

http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf