Hello Guest it is April 25, 2024, 06:03:34 PM

Author Topic: Hybrid Stepper Motor Driver Alarm Line Handling  (Read 752 times)

0 Members and 1 Guest are viewing this topic.

Hybrid Stepper Motor Driver Alarm Line Handling
« on: June 28, 2021, 10:41:20 AM »
I have a pair of hybrid stepper motors on my lathe conversion, and the alarm lines from the motor drivers are now connected to the ESS.

These lines will go high if the motor cannot reach a commanded position - normally meaning a jam of some sort.

The lua scripting manual suggests the best place to handle these alarms in the PLC script.

Are there any examples availible?
Re: Hybrid Stepper Motor Driver Alarm Line Handling
« Reply #1 on: June 28, 2021, 12:02:15 PM »
I would just map it to an input and use the signal library to run any code
Re: Hybrid Stepper Motor Driver Alarm Line Handling
« Reply #2 on: June 29, 2021, 07:20:08 AM »
Hi,
using the PLC is the old school way of thinking. The PLC script runs every few milliseconds and samples the signal  each
time it runs. This is called 'polling' an input, it works but is not efficient.

SwiftyJ is right, map the input in the Signal Library, and use a screen load script.

Have a look at the explanation of how the Signal Library works in SignalLibrary.pdf:

https://www.machsupport.com/forum/index.php?topic=40051.0

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Hybrid Stepper Motor Driver Alarm Line Handling
« Reply #3 on: June 29, 2021, 05:24:26 PM »
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.