4731
Mach4 General Discussion / Re: output on/off from same button
« on: April 24, 2018, 03:47:20 PM »
Hi,
sometimes it is easier to program a function, in this case a toolchange, without too many or even any interlocks. Once you have the function working THEN start applying
interlocks for safety.
If I understand your machine requires air pressure to run. Thus if you'll have an air pressure switch. It is a fairly simple matter to have the function not start if the air pressure is not OK, but what happens
if the pressure drops part way through the toolchange? I can well imagine you want your program to respond to that situation and that is very much harder. May I suggest that to start with do the easy
option and later decide whether the extra protection is really required and how you might do it.
As an example, say:
ISIG_INPUT10=air pressure OK
ISIG_INPUT11=tool present
ISIG_INPUT12=door closed
Then:
Function m6()
local hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT10)
AirOK=mc.mcSignalGetState(hsig)
hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT11)
ToolPresent=mc.mcSignalGetState(hsig)
hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT12)
DoorClosed=mc.mcSignalGetState(hsig)
If AirOK ~=1 then
mc.mcCntlSetLastError(inst,' Air Pressure Fault')
return --If the air pressure is bad then message the fault then abort the toolchange by returning to the calling program
else
-go to position
-release tool
-....
-.... -- the body of the toolchange function
end
if (AirOK and DoorClosed and ToolPresent)==1 then
m3
mc.mcCntlCycleStart(inst) -- if all the interlocks are OK THEN start the spindle and 'push' cycle start
end
end
Maybe a few ideas.
Craig
sometimes it is easier to program a function, in this case a toolchange, without too many or even any interlocks. Once you have the function working THEN start applying
interlocks for safety.
If I understand your machine requires air pressure to run. Thus if you'll have an air pressure switch. It is a fairly simple matter to have the function not start if the air pressure is not OK, but what happens
if the pressure drops part way through the toolchange? I can well imagine you want your program to respond to that situation and that is very much harder. May I suggest that to start with do the easy
option and later decide whether the extra protection is really required and how you might do it.
As an example, say:
ISIG_INPUT10=air pressure OK
ISIG_INPUT11=tool present
ISIG_INPUT12=door closed
Then:
Function m6()
local hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT10)
AirOK=mc.mcSignalGetState(hsig)
hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT11)
ToolPresent=mc.mcSignalGetState(hsig)
hsig=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT12)
DoorClosed=mc.mcSignalGetState(hsig)
If AirOK ~=1 then
mc.mcCntlSetLastError(inst,' Air Pressure Fault')
return --If the air pressure is bad then message the fault then abort the toolchange by returning to the calling program
else
-go to position
-release tool
-....
-.... -- the body of the toolchange function
end
if (AirOK and DoorClosed and ToolPresent)==1 then
m3
mc.mcCntlCycleStart(inst) -- if all the interlocks are OK THEN start the spindle and 'push' cycle start
end
end
Maybe a few ideas.
Craig