This is the script I use for my mill. The ESS Inputs will probably not be the same as yours, but it should give you a starting point (The ToolChangeMsg and Keyboard Inputs Toggle at the start and end , are only there to show where I slotted the alarm script into the screen load script):-
mm.ToolChangeMsg("A tool change has been requested via M6. Change your tool then press Cycle Start to continue!", "Tool Change Active!")
end
end
end,
-----------------------------------------------------------
--- Axis Drive Fault Alarm
----------------------------------------------------------
[mc.ISIG_INPUT30] = function (state)
DriveAlarm()
end,
[mc.ISIG_INPUT31] = function (state)
DriveAlarm()
end,
[mc.ISIG_INPUT32] = function (state)
DriveAlarm()
end,
[mc.ISIG_INPUT33] = function (state)
DriveAlarm()
end
}
--------------------------------------------------------------
-- Axis Drive Alarm Function
---------------------------------------------------------------
function DriveAlarm()
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT30) -- Is mapped to Port 3 Pin 10 -- X Axis Drive
local XDriveAlarm, rc = mc.mcSignalGetState(hSig)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT31) -- Is mapped to Port 3 Pin 11 -- Y Axis Drive
local YDriveAlarm, rc = mc.mcSignalGetState(hSig)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT32) -- Is mapped to Port 3 Pin 12 -- Z Axis Drive
local ZDriveAlarm, rc = mc.mcSignalGetState(hSig)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT33) -- Is mapped to Port 3 Pin 13 -- 4th Axis Drive
local ADriveAlarm, rc = mc.mcSignalGetState(hSig)
if XDriveAlarm == 1 then
mc.mcCntlEStop(inst)
wx.wxMessageBox ("X Axis Drive Fault")
elseif YDriveAlarm == 1 then
mc.mcCntlEStop(inst)
wx.wxMessageBox ("Y Axis Drive Fault")
elseif ZDriveAlarm == 1 then
mc.mcCntlEStop(inst)
wx.wxMessageBox ("Z Axis Drive Fault")
elseif ADriveAlarm == 1 then
mc.mcCntlEStop(inst)
wx.wxMessageBox ("4th Axis Drive Fault")
end
end
---------------------------------------------------------------
-- Keyboard Inputs Toggle() function. Updated 5-16-16
---------------------------------------------------------------
Hope this helps,
Nick.