As for stopping the spindle when the E-Stop is triggered, this code in the Signals Library of the Edit Screen WX6/ScreenLoadScript works for me:
[mc.ISIG_EMERGENCY]=function(state)
if (state == 1) then
mc.mcScriptExecute(inst,"m5.mcs",0);
end
end,
With this code my Teco 7300CV under Modbus turns off the spindle with an M5 command from Mach4.
-rick