Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Ewalk02 on August 02, 2021, 08:45:56 PM

Title: Need help triggering feedhold with a driver alarm - Mach 4
Post by: Ewalk02 on August 02, 2021, 08:45:56 PM
I have hybrid stepper motors on my plasma table and I would like the alarm function to trigger a feed hold in Mach 4.  I have tried numerous different times to write the code myself (more like copying others code) but I can't get it to work.  Right now I have the code where it reads the pin when the state changes and it sends an error message but I can't get it to trigger a feed hold no matter what I try.  Any help would be appreciated.

Code so far:

[mc.ISIG_INPUT0] = function (state)       -- X Axis
        mc.mcCntlSetLastError(inst, "X Axis driver ALARM - STOPPING")
    end,

Thanks!
Title: Re: Need help triggering feedhold with a driver alarm - Mach 4
Post by: DazTheGas on August 03, 2021, 05:09:20 AM
Try using mc.mcCntlFeedHold(inst) after you have set your error

DazTheGas
Title: Re: Need help triggering feedhold with a driver alarm - Mach 4
Post by: RecceDG on August 03, 2021, 12:32:59 PM
Code: [Select]
-------------
-- Axis driver Alarms
-- Each motor driver has an alarm line that goes high
-- if ********* goes south
-- Stop machine and recover using external reset switches

    [mc.ISIG_INPUT9] = function (state)       -- X Axis
        mc.mcCntlSetLastError(inst, "X Axis driver ALARM - STOPPING")
eStop()
    end,

    [mc.ISIG_INPUT10] = function (state)       -- Z axis
        mc.mcCntlSetLastError(inst, "Z Axis driver ALARM - STOPPING")
eStop()
    end,


I wouldn't feed hold - I'd eStop.

Driver alarm means "I tried to get to the commanded move point but didn't get there" so you have lost positioning and something is very wrong.

That's a "shut everything off NOW" situation.
Title: Re: Need help triggering feedhold with a driver alarm - Mach 4
Post by: KatzYaakov on August 03, 2021, 03:43:04 PM
i think PMC can be the best way
Title: Re: Need help triggering feedhold with a driver alarm - Mach 4
Post by: Ewalk02 on August 03, 2021, 09:14:04 PM
Try using mc.mcCntlFeedHold(inst) after you have set your error

DazTheGas

This worked perfectly, thanks!
Title: Re: Need help triggering feedhold with a driver alarm - Mach 4
Post by: Ewalk02 on August 03, 2021, 09:18:22 PM

I wouldn't feed hold - I'd eStop.

Driver alarm means "I tried to get to the commanded move point but didn't get there" so you have lost positioning and something is very wrong.

That's a "shut everything off NOW" situation.
I wouldn't feed hold - I'd eStop.

Driver alarm means "I tried to get to the commanded move point but didn't get there" so you have lost positioning and something is very wrong.

That's a "shut everything off NOW" situation.
[/quote]

I thought about estop but since it's a plasma table I'm not too worried about a few lost steps, I wanted to be able to start back up if things were still close.  I have limit switches on both sides of all the axis and a magnetic torch head so I doubt I could crash it too bad.  I'll probably eat those words one day but for now it makes sense in my head.