Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: gabedrummin on March 07, 2025, 03:14:16 PM
-
Can anyone or dose anyone have any idea what would cause the mdi input not to excute what is input in the box . What cause's it not to excute . Is there any dianostic tool to show why it is frozen . How do you trouble shoot this isuue.Thank you
-
Mach4's MDI box does not execute upon entering a carriage return.
Did you click on Cycle Start?
-
Yes I hit enter So if I home machine z,x and turret all will home . ASk for a tool change T0101 . It dose not matter if you put an M06 or a G00 WITH OR WITHOUT SAME RESULTS . Some times ti will chage a tool other time's it sit's . What I find that works best . My machine tool 6 .If I do tool t0303 first then tool t0101 most of the time it works . Its very fustrating all the time to shut it down re-boot and hope this time it works . I dont wanrt to say it buggy . I have use it like this for many years . I just wish there was a difenative way you should do things to get an expected out come .I used to running industrial machines with Fanuc controller and if I enter something in MDI right or wrong the machine will excute it reguadless of the out come.
-
I would start by looking at the tool change code. Post it here and we can see if there is a fault.
-
function m6()
local inst = mc.mcGetInstance() --Get the instance of Mach4
mc.mcCntlGcodeExecuteWait(inst, "g04 p500")
mc.mcCntlCycleStart(inst)
local currentTool = mc.mcToolGetCurrent(inst) --looks for the tool currently selected
local selectedTool = mc.mcToolGetSelected(inst) -- looks at the tool you have selected
local tpos = (selectedTool * 60) --Tool position is the current tool number * 60 (example tpos = (selected tool) Example tool 2 --> 2 * 60 = tpos = 120)
local Out = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT21) --Get handle for output 22 and set to "out" variable
local release = ((currentTool * 60) + 2.0)
--local currentTool = 1
--local selectedTool = 4
if (selectedTool ~= currentTool) then --Change tool: if the selected tool isnt = to the current tool, you want to change your tool
local hReg, rc = mc.mcRegGetHandle(inst, "iRegs0/CurrentSlot")
if (selectedTool > currentTool) then
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos + 2.0 )))
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f" , tpos)) --Reference, move to position, back up to lock position
mc.mcCntlGcodeExecuteWait(inst, "g04 p500")
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - .5 )))
rc = mc.mcRegSetValue(hReg, selectedTool)
mc.mcToolSetCurrent(inst, selectedTool)
elseif(selectedTool < currentTool) then
--mc.mcSignalSetState(Out, 1) --Turn OUTPUT21 on
--mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - 30 )))
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G1 F3000 A%4.4f", ( release )))
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
mc.mcSignalSetState(Out, 1) --Turn OUTPUT21 on
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
--mc.mcSignalWait(inst, out, WAIT_MODE_HIGH, 2.); -- we waitup to 2 seconds for input 21 to go high
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f" , tpos)) --Reference, move to position, back up to lock position
--mc.mcSignalSetState(Out, 0) --Turn OUTPUT21 off
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
mc.mcSignalSetState(Out, 0) --Turn OUTPUT21 off
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - .5)))
rc = mc.mcRegSetValue(hReg, selectedTool)
mc.mcToolSetCurrent(inst, selectedTool)
end
end
--This function is here to allow the debugging from the Lua editor
if (mc.mcInEditor() == 1) then
m6()
end
end
--end