6281
Mach4 General Discussion / Re: Mach4 Spindle At Speed, Spindle Zero Problem
« on: October 17, 2017, 03:01:40 AM »
Hi Hakan,
assign Input#62 to your spindle-at-speed pin and Input#63 to your spindle-stopped pin:
and:
See how that works.
Craig
assign Input#62 to your spindle-at-speed pin and Input#63 to your spindle-stopped pin:
Code: [Select]
function m3();
local inst=mc.mcGetInstance();
mc.mcSpindleSetDirection(inst,mc.MC_SPINDLE_FWD);
mc.mcCntlSetLastError(inst,"m3 waiting");
local returncode=mc.mcSignalWait(inst,mc.ISIG_INPUT62,mc.WAIT_MODE_HIGH,10);
if (returncode==mc.MERROR_TIMED_OUT) then
mc.mcCntlSetLastError(inst,"spindle does not respond");
mc.mcSpindleSetDirection(inst,mc.MC_SPINDLE_OFF);
else;
mc.mcCntlSetLastError(inst,"m3 at speed");
end;
end
if (mc.mcInEditor() == 1) then
m3()
end
and:
Code: [Select]
function m4();
local inst=mc.mcGetInstance();
mc.mcSpindleSetDirection(inst, mc.MC_SPINDLE_REV);
mc.mcCntlSetLastError(inst,"m4 waiting");
local returncode=mc.mcSignalWait(inst,mc.ISIG_INPUT62,mc.WAIT_MODE_HIGH,10.0);
if (returncode==mc.MERROR_TIMED_OUT) then
mc.mcCntlSetLastError(inst,"spindle does not respond");
mc.mcSpindleSetDirection(inst,mc.MC_SPINDLE_OFF);
else;
mc.mcCntlSetLastError(inst,"m4 at speed");
end;
end
if (mc.mcInEditor() == 1) then
m4()
end
and:Code: [Select]
function m5();
local inst=mc.mcGetInstance();
mc.mcSpindleSetDirection(inst,mc.MC_SPINDLE_OFF);
mc.mcCntlSetLastError(inst,"m5 stopping");
local returncode=mc.mcSignalWait(inst,mc.ISIG_INPUT63,mc.WAIT_MODE_HIGH,10.0);
if (returncode==mc.MERROR_TIMED_OUT) then
mc.mcCntlSetLastError(inst,"spindle does not respond");
mc.mcSpindleSetDirection(inst,mc.MC_SPINDLE_OFF);
else;
mc.mcCntlSetLastError(inst,"m5 is stopped");
end;
end
if (mc.mcInEditor() == 1) then
m5()
end
See how that works.
Craig