Hello Guest it is March 29, 2024, 10:40:01 AM

Author Topic: Custom Error and stopping a program?  (Read 799 times)

0 Members and 1 Guest are viewing this topic.

Custom Error and stopping a program?
« on: November 13, 2018, 10:16:38 PM »
Howdy all..

  I am trying to figure out the best way to achieve the following...

I have several inputs that signify an error that are setup on various input ports  (High level feedbacks from my CLEARpath Servos, a Spindle alarm, and a low air pressure alarm)...  I would like to configure Mach 4 so that if any of these 6 (or 7 if I add a 4th axis)  inputs activate (high or low depending) its treated like an error and stops the program (like hitting E-STOP or a limit switch would)..  What is the best way to configure (or program) custom error trapping and error messages in mach 4 so I can alarm out if something goes wrong..

Thanks
Josh
Re: Custom Error and stopping a program?
« Reply #1 on: November 13, 2018, 11:57:43 PM »
Hi,
easy enough.....lets assume you have assigned one of your fault inputs to ISIG_INPUT10 then you need to put
the following in the SigLib table which is near the top of the screenload script.

Code: [Select]
[mc.ISIG_INPUT10]=function(state)
local inst=mc.mcGetInstance()
if state==1 then
mc.mcCntlEStop(inst)
end
end,

You will need to repeat this for as many fault inputs you have, probably using ISIG_INPUT11, ISIG_INPUT12 etc.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'