Hello Guest it is April 21, 2021, 02:12:19 PM

Author Topic: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke  (Read 3892 times)

0 Members and 1 Guest are viewing this topic.

Hi,
given that it was unplugged should mean that it would not produce any electrical noise but there could still be a conductive path
between the motor frame and the windings and therefore the speed drive. I would still remove it just to absolutely remove any potential
earth leakage path.

I'm guessing that one of your power supplies has a leakage path to earth. Lets say your power supply for your steppers, and I'll guess its
48V. It should be isolated so that if one wire (+ or -)of the power supply touches the frame (earthed) no current will flow. If there is a leakage path
to earth within the power supply however then some current would flow, maybe not much perhaps just a few milliamps but enough to cause noise
faults and damage electronics. It may also be that the power supply for your ESS and/or PoKeys has leakage to earth. That could mean that current
is flowing in signal wires due to that leakage, a prime cause of noise faults.

Craig
My wife left with my best friend...
     and I miss him!
When you say remove it, just make sure it cant touch the machine case? Or mounted to the machine
Hi,
in my case I removed the spindle, that is un-mounted it and that when the problem showed up. By having the spindle motor bolted in place the problem was
not evident but it had been there all the time.

It was only when I one by one hooked up the home switches...then retest....the limit switches.....then retest...the x motor...then retest....the y motor ...then retest, well
you get the picture. That was the only way I could find the fault and make a plan to fix it.

Craig
My wife left with my best friend...
     and I miss him!
ive entered the code but changed pin # from 10 to 13 input an it doesn't work,..i tried changing the  active high an low,... still no go  i enabled it under ess as sig 13 cycle start mapped to ess,... an in control under mach its under port 1 pin 13 in tried both act. H/L its also enabled under control,  inputs, enabled under input 13 mapped to ess sig 13 cycle start.... any time i touch wire to +/- doesnt cycle strt,... code as follows



[mc.ISIG_INPUT13]=function(state)
   if state==1 then
      CycleStart()
   end
end
Hi,
 try my suggestion and use input #0-#5, then an LED will display on the Machine Diagnostics tab. You can still use port 1 pin 13 but
assign input#2 say to the pin.

Where did you put the code?

Craig
My wife left with my best friend...
     and I miss him!
Hi,
 try my suggestion and use input #0-#5, then an LED will display on the Machine Diagnostics tab. You can still use port 1 pin 13 but
assign input#2 say to the pin.

Where did you put the code?
[mc.ISIG_INPUT1]=function(state)
   if state==1 then
      CycleStart()
   end
end
Craig

soput 1 in input or 01
light is on an when i touch the two together it gos out but not cycle start or when i flip the active h/l i get it to reverse the light  being off then on when touched either way no go on cycle start,...i tried moving code into the click box an no go
« Last Edit: July 01, 2018, 03:21:45 PM by jbraddock »
my guess is in the code but thats where i fall short
i dont change this at all right?


Hi.
can't help with all of those questions but I can show you how to do a few of them.

Have you watched the 'Edit Screen' video....you need to watch it.

In edit screen mode have a look at the <Cycle Start> button events. I have posted a screen shot of it. Note that the event has a 'left up script' That means when the screen button
is released the nominated script executes. In this case its not a script per se but rather a Lua function CycleStart().

Just as a matter of interest this is the source code of the function.....its in the screen load script:
Code: [Select]
---------------------------------------------------------------
-- Cycle Start() function.
---------------------------------------------------------------
function CycleStart()
    local rc;
    local tab, rc = scr.GetProperty("MainTabs", "Current Tab")
    local tabG_Mdione, rc = scr.GetProperty("nbGCodeMDI1", "Current Tab")
    local tabG_Mditwo, rc = scr.GetProperty("nbGCodeMDI2", "Current Tab")
   
    --See if we have to do an MDI command and if so, which one
    if ((tonumber(tab) == 0 and tonumber(tabG_Mdione) == 1) or (tonumber(tab) == 2 and tonumber(tabG_Mditwo) == 1 )) then
        local state = mc.mcCntlGetState(inst);
        if (state == mc.MC_STATE_MRUN_MACROH) then
            mc.mcCntlCycleStart(inst);
            mc.mcCntlSetLastError(inst, "Do Cycle Start");
        else
            if (tonumber(tab) == 0) then 
                scr.ExecMdi('mdi1');
                mc.mcCntlSetLastError(inst, "Do MDI 1");
            else
                scr.ExecMdi('mdi2');
                mc.mcCntlSetLastError(inst, "Do MDI 2");
            end
        end
    elseif tonumber(tab) > 2 then --No G Code or MDI panel is displayed so Do Nothing
        mc.mcCntlSetLastError(inst, "Nothing to Start");
    else --Do CycleStart
        mc.mcCntlSetLastError(inst, "Do Cycle Start");
        mc.mcCntlCycleStart(inst);       
    end
end

Don't concern yourself with the code....I only mentioned it so that you could see in fact there is a bunch of code that runs when you call what looks like such a simple function call CycleStart().

In order that you can hit a remote button and have the cycle start what you want to do is have an input to Mach from the physical button call CycleStart() as if you'd hit the screen button.

In the ESS or PoKeys plugin assign an input pin to the physical button. Then in the Input Signals page in the ESS plugin (presumably the PoKeys plugin is similar but I'm not familiar with it)
connect that pin to a general purpose input signal ISIG_INPUT10 say.

Now you will need to put in the SigLib table an entry to tell Mach we are interested if the signal ISIG_INPUT10 triggers.

Code: [Select]
[mc.ISIG_INPUT10]=function(state)
if state==1 then
CycleStart()
end
end

And THAT'S IT!  If you put that little piece of code into the SigLib table which is at the top of the screenload script you have coded all that is required to have Mach4 monitor an input
and execute a function when the input triggers. How easy is that?

You might have noticed that I attached a second screenshot of the <FeedHold> button. Note that it has a left up action. An action is internal to Mach and the  above method wont work
for that action. I'm sure it can be done but need to think about it a bit more yet.

If in edit screen mode you click on various buttons that about half have either a script or a fuction as an event for which the recipie above will work and the rest have actions as events.
I will do some more thinking and research and get back to you.

Craig
i went of this this isnt right? i put code inside the left up