I ran across this thread while I was looking to implement something similar so I’ll share my solution in case it helps someone in the future.
The previous suggestions might work for others but in my scenario: I didn’t want to just edit my PP to disable my power draw bar circuit while the spindle is spinning because that solution wouldn’t apply to gcode created with intercon programming or when operating the spindle in manual mode. Also, a drawbar sensor is a good idea, but I don’t have one.
Instead I chose to edit the PLC to create a lockout on the Power Draw Bar (PDB) when the spindle is running.
In my build, I use a normally open foot switch to actuate an air solenoid which actuates the PDB. In addition, I use the normally closed side of the OUT4 relay in series with the foot switch to act as the safety relay. I have assigned the parameter SPINDLEBRAKERELEASE to OUT7 in the wizard. I do this because my spindle is controlled by the PWM output and Acorn doesn’t keep this pin low at all phases of the boot up sequence on the initial application of power. By running it through the NC side of OUT 7, I guarantee my spindle only receives a PWM command when SPINDLEBRAKERELEASE is asserted. The relevant portions of my relay board schematic are below:
By default, Centroid supplies a series of M functions to be used with the relay board outputs. The files mfunc6X.mac use an M94 to turn on relay board output X and mfunc8X.mac files use an M95 to turn off relay board output X. In this case, the Power Draw Bar safety relay is on OUTPUT 4 so this implementation will use M64 and M84.
The default PLC code already has M64 mapped to OUTPUT4 with this line:
"IF M64 THEN (OUTPUT4)"
The PDB safety relay (OUT 4) should follow the same logic as the spindle brake release relay (OUT 7) when turning on the spindle to safe the PDB. When turning off the spindle, its desirable to have the Power Draw Bar safety relay (OUT 4) wait a couple seconds after the spindle brake is engaged to ensure the spindle is stopped before re-enabling the power draw bar.
To do this, add a timer definition (Code starts at line 2040 in the .src file). Timer 34 is the first unused timer on my machine. I think Centroid supports up to 64 timers.
Line 2077 in my PLC became: PowerDrawBarTimer IS T34
The timer need to be initialized to a value in milliseconds. This should be done with the other timers defined in the .src starting at line 2159. I've found it takes ~1.5 seconds for my spindle to come to a dead stop from full speed so I set the timer to 2 seconds for some margin:
Line 2184 in my PLC became PowerDrawBarTimer = 2000,
The remainder of the changes can make significant re-use of the Spindle Brake Release logic already in the PLC starting around line 4095.
The logic used to turn on the SpindleBrakeRelease around line 4116 can be edited to also SET M64 which will in turn enable OUTPUT4 and therefore disable the Power Draw Bar circuit.
; Turn on SpindleBrakeRelease and OUTPUT 4 if SpindleBrake is enabled and when spindle is
; requested to turn on OR the SpinBrakeMode_M is off.
IF !SpindleBrakeDisabled_M &&
((StandardSpindleStage && SpindleEnableOut_M) ||
(G540SpindleStage && (SpindleForward_M || SpindleReverse_M)) ||
SpinBrakeOn_M)
THEN SET SpindleBrakeRelease, SET M64
The logic used to turn off the SpindleBrakeRelease around line 4126 can be edited to also SET PowerDrawBarTimer which will begin the 2 second count down. After the PowerDrawBarTimer completes, then M64 is reset with an RST M64 and the timer is reset with a SET PowerDrawBarTimer.
IF !SpindleBrakeDisabled_M &&
((StandardSpindleStage && !SpindleEnableOut_M && !SpinBrakeOn_M) ||
(G540SpindleStage && (!SpindleForward_M && !SpindleReverse_M) && !SpinBrakeOn_M) ||
(SpinBrakeOff_M && !((StandardSpindleStage && SpindleEnableOut_M) ||
(G540SpindleStage && (SpindleForward_M || SpindleReverse_M)))))
THEN RST SpindleBrakeRelease, SET PowerDrawBarTimer
This implementation will disable the Power Draw Bar regardless of if the spindle was turned on in manual mode, from the vcp or mpg, or if commanded through MDI with an M3, or if called with an M3 through an executing G-code file. If you are comfortable editing the PLC, its quite easy to implement.
Hope this helps someone out in the future.