Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jbraddock on June 30, 2018, 08:26:18 PM

Title: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on June 30, 2018, 08:26:18 PM
using mach 4 on win 10

 there is a keyboard plugin in mach 4 but it has loaded with keystrokes you can map to keys but its limited in what functions you can map to a key,...or is ther a way to add some that arent ther into it...
whats the easiest way i can make mach4 buttons like "CYCLE START" , "FEED HOLD", "STOP", ''ENABLE"  need to start when i hit a key on keyboard,... im thinking its in the lua script or code im guessing but i have not a clue in how to do it or use it, ive tried to figure the script out but its just to much right now im pulling my hair out tryn to figure it out, Therese no vids that i know of unless yal can point me in right direction
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 09:14:44 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 09:17:07 PM
Hi,
oops, sorry forgot to attach the screen shots....

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on June 30, 2018, 09:24:46 PM
Whay will trigger the esz input 5v or grnd?
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 09:45:48 PM
Hi,
on the ESS Pins Config page you have the choice of active high OR active low.

I don't know how you've wired your button and whether your BoB has a pull-up or a pull down resistor. Active high OR active low will depend
on those details.

Just another idea is that on Machs Machine Diagnostics tab, at least in the wx4.set screen set, there is a whole bunch of LEDs, in particular notice the Iinput0 through Input5
in the Inputs panel. If you chose to attach your ESS/BoB input pin to ISIG_INPUT0 say, rather than my earlier suggestion of ISISG_INPUT10 then every time you hit your button
you should see the LED light up. Very simple and convenient way to test to button and circuit.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on June 30, 2018, 11:06:27 PM
I dont want to burn it up by hooking + or - into wrong input
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 11:10:29 PM
Hi,
yes I understand your caution.

Are you using the ESS? If so what breakout board are you using, or even are you using a breakout board?

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 11:16:49 PM
Hi,
I've attached a representative circuit diagram of an ESS input.

Provided you don't put MORE than 5V on the OR less than 0V then you cant blow the ESS by hooking up either + or -.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on June 30, 2018, 11:26:26 PM
Hi,
it is perfectly possible to hook direct to the pins of the ESS but preference is given to hooking up a breakout board. Firstly because they have screw terminal
you are less likely to accidently bridge two pins causing a fault. I use MB2s from Homan Designs in Austrailia, near enough to local for me.
I see the C10 board is reasonably priced and doesn't have to much in the way of specialised pin circuitry to interfere with flexibility.

Given the cost of the ESS and how central it is to my mill I would not contemplate using any port of the ESS WITHOUT a breakout board.
I work with electronics day in day out and I value any methods/procedures/designs that limit unintentional damage to boards, especially so if I have to
pay for a replacement!

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on June 30, 2018, 11:38:53 PM
C11g i believe  but im using 10 through 15 for  limits an emergency stop so i think im out of inputs they are labeled outputs in diagram but i belive thst a typo those are inputs

https://www.automationtechnologiesinc.com/products-page/breakout-boards-mpg/c11g-multifunction-cnc-board/
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 12:01:46 AM
This info you are giving me is a way to add button by bob, but to add a keystroke function do you know how thats done?, ive purchased a programmable keyboard that has 80 keys that can have functions programmed to keys an i also have a ipac that emulates keyboard keys,..i went through 2 pokey cards with no luck, not sure why there not working
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 12:06:40 AM
Hi,
the C25 is a good board and suits a machine that uses one port only. Thus the C25 has outputs for the motors and spindle etc.

The C10 on the other hand has just plain inputs and outputs. You could use it to run a machine but it doesn't have any relays for the spindle nor does it have
an analogue output for a VFD. It is ideal though as a second (or third) board for the ESS. In particular the pins 2-9 can be designated as input OR outputs.

As you have discovered it is common to run out of inputs and so the C10 is very useful because it allows you to take full advantage of the extra ports of the ESS.
cnc4pc also have the C13 breakout board, and for only $9.00. It has no buffer ICs on it however and so you don't get any protection just screw connectors.
For an extra $14.00 I would get the C10 which does have buffer ICs on board and offers a degree of protection for the ESS that the C13 doesn't have.

I'm not familiar with the PoKeys 57CNC other than that they have a good reputation. I've had a look at the manual and they have little or no protection for the
FPGA IC either.  If I had one I would be inclined to fit some sort of breakout board to protect the FPGA exactly as I have done for my ESS.

You can of course go direct onto the pins of the ESS second (or third) ports. The 26pin IDC headers are pretty compact and the probability of shorting two pins together is
quite high. I have attached  a pic of the representative output circuit of the ESS. Note the output IC has no current limiting resistors between the IC pins and the IDC26
pins. Therefore if you were to accidentally short an output to either + or - when the IC output was - or + respectively you will blow the one channel of the output IC.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 12:12:50 AM
Hi,
OK so you have a keyboard not just a series of push buttons?

Does the keyboard come with any documentation as to how the keys are coded?

Its possible that the keyboard issues serial pulses to represent ASCII characters in which case we a re barking up the wrong tree.

Do you mind me asking why bother with another keyboard? I mean it sounds like you are duplicating the keyboard on your PC. There is a thread by a guy
who has made his own panel which had individual pushbuttons for various functions and an MPG handwheel. I'll see if I can find it.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:13:56 AM
C11g i believe  but im using 10 through 15 for  limits an emergency stop so i think im out of inputs they are labeled outputs in diagram but i belive thst a typo those are inputs

https://www.automationtechnologiesinc.com/products-page/breakout-boards-mpg/c11g-multifunction-cnc-board/

Sordy i had to double check i te wrote it i guess after you posted c25 info
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:21:01 AM
Hi,
OK so you have a keyboard not just a series of push buttons?

Does the keyboard come with any documentation as to how the keys are coded?

Its possible that the keyboard issues serial pulses to represent ASCII characters in which case we a re barking up the wrong tree.

Do you mind me asking why bother with another keyboard? I mean it sounds like you are duplicating the keyboard on your PC. There is a thread by a guy
who has made his own panel which had individual pushbuttons for various functions and an MPG handwheel. I'll see if I can find it.

Craig

notice my card is not a c25 its c11g i posted website...

On key board its not here yet...its a x keys board i think is brand,...but i have been tryn to use external switches but
Ive been through 2 pokey cards tryn to get the external buttons working, il get it working for a few mins then the card locks up an wont let me back in it, so thats why im try something different witb the key strokes because if i can map functions to keys then the ipac will do my external joysticks an my e keys will do my other  random functions...im feel so beat thats why im tryn to use the keyboard plugin in mach 4 so im not burning up cards with inputs an outputs if thats whats killing my cards
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 01:22:03 AM
Hi,
sorry I misread your post. The C11 and C25 share many similarities. I would still recommend additional, or at least one, C10 if you wish to extend the number of inputs
you have available.

From your previous post regarding a programmable keyboard we may be getting a bit ahead of ourselves.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:24:16 AM
You are posting faster than me, read my last post... sorry
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:26:40 AM
I have a c10 bob for my mach 3, but not the 11 or 25
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 01:31:16 AM
Hi,
I see your problem. I rather suspect it may be related to the noise issue you have described in your other thread.

If there is some leakage current getting into the frame of your machine it would certainly cause noise issues but could also fry inputs of PoKeys boards,
my earlier post states that PoKeys boards employ little or no protection on their inputs and possibly explain why they appear sensitive and are failing.

May I suggest rather than expend more time and money on a remote keyboard that you solve the noise issue, especially if it appears to be damaging boards.

In the mean time would you post whatever information you have about your programmable keyboard. Thinking about something doesn't cost anything!

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:35:55 AM
I will in am. Im gonna try what you suggested in code tomorrw as well, on another note i bought another ess an bob combo, i tried changing bob first, an it still had same error on my other post, but when i changed out the ess it has went away, but in that process i had my old ess with new pokeys hooked to it an thats when 2nd pokeys quit, im now back to new ess with new bob an so far errors are gone...
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:43:35 AM
I belive when i hooked first pokeys up i ran a input into a output or something to thst nature tryn to figure out that inc jog button, thats when all hell broke loose, since then i have tried to get it stable but i think that pokeys fed into ess an messed it up, i figured it was the bob but i guess i was wrong it was ess or both, i am atleast error free now
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 01:52:39 AM
http://xkeys.com/xkeys/xk80.php

Keyboard i ordered to setup jog an inc jog fu ctions along with other functions
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 02:04:39 AM
Hi.
yikes!  That sounds like an expensive learning curve, so you have two Pokeys and one ESS boards which are potentially faulty.
I would certainly like to get to the bottom of that before I did anything else.

You may have noted that in the other thread:
http://www.machsupport.com/forum/index.php/topic,37598.msg257219.html#msg257219 (http://www.machsupport.com/forum/index.php/topic,37598.msg257219.html#msg257219)
that there is a possibility that current is leaking into the frame of your machine. My steppers do so, an unusual mechanisim but it happens.
The first time I knew anything about it I had removed my spindle and inadvertently removed the earth bonding. I only recognized it when I got a good
'tingle' off the machine while trying to track a fault with my Estop. It turns out that the leakage blew the input buffer on my BoB, fortunately it didn't affect
my ESS. It has made me a little more cautious though!

To be honest I would go back to square one, disconnect EVERYTHING off your machine. Particularly the spindle and driver. I would remove the earth bonding also. THEN I would hook up things ONE AT A TIME
measuring the voltage of ALL metal parts of the frame against a KNOWN GOOD POWER EARTH. This is exactly what I did with my mill until I had it nailed down as to what components (steppers)
were contributing leakage current (approx. 1mA each) and under what circumstances.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 02:11:57 AM
Hi,
that keyboard is going to need a plugin between its USB port and Mach.

I can help with individual push button switches, an MPG and that sort of thing but trying to write a plugin to interface with Mach is quite an undertaking,
its beyond my pay grade!

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:14:02 AM
How does it leak? It would have to be a short? I know for a fact its not in my spindle motor with it off it caused the error in previous post, but like i said its not been back but i understand it could return,...am i understanding you right to ground to 120v green to the machine? Im in usa so not sure where you are, but we use black hot, white common, green is ground
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:16:41 AM
Hi,
that keyboard is going to need a plugin between its USB port and Mach.

I can help with individual push button switches, an MPG and that sort of thing but trying to write a plugin to interface with Mach is quite an undertaking,
its beyond my pay grade!

Craig
It shouldnt if its mapped to keystrokes, an my keystrokes in machs plugins are what i map it to,...but it may get returned if we can get it setup with switches, i already have my square momentary an on off switches an joysticks ready for install
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:19:16 AM
A key stroke should be a keystroke whether it comes from keyboard or pad is my argument but you see how much ive been wrong so wouldn't surprize me
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:19:57 AM
Where are you located?
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 02:29:43 AM
Hi,
Quote
How does it leak? It would have to be a short?
No not necessarily, it could be a  resistive leak. Your will need to test the spindle motor for leakage resistance to earth. In New Zealand we call it a Megger,
the technical name for the test is 'high potential earth leakage test'. The other possibility is as I found with my steppers that there was current induced into the
frame, not a conductive path at all. That would be hard to trace but not impossible.

There are a couple of other possibilities also, particularly if you have switch mode power supplies. They can leak to earth.

Still the most likely culprit is your spindle. I know you think it impossible but it is by far and away the biggest noisy component of your machine. I would take it off altogether
and see what happens. If I'm correct it has blown about $450.00 worth of boards....do you want continue?

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:39:45 AM
Well on spindle i unplugged it from power, when it was doing the errors, thats why i say it shouldnt be that cuz it was throwing errors without power hooked to speed controller , its hooked to a ext cord an it was unplugged completely, when i continued to get errors before, so if i had it disconected that should eliminate that right? I dont know anyway it vould cause noise without power
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 03:03:05 AM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 03:06:19 AM
When you say remove it, just make sure it cant touch the machine case? Or mounted to the machine
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 03:15:30 AM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 02:47:21 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 02:59:44 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 03:10:33 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 03:17:28 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 03:22:42 PM
my guess is in the code but thats where i fall short
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 03:30:48 PM
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
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 05:21:13 PM
i went of this this isnt right? i put code inside the left up
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 05:29:23 PM
Hi,
oops, sorry forgot to attach the screen shots....

Craig


this is what i went off of this is where i put code i treid left dwn an up script,...thats not right, thought thats where you said an circled it to show where it gos?

its nort showing screen shots for some reason ive tried to post them but they artent posting
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 05:32:42 PM
Hi,

Quote
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

The code goes into the signal library table (SigLib{}).

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 05:38:38 PM
Hi,

Quote
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

The code goes into the signal library table (SigLib{}).

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: joeaverage on July 01, 2018, 05:39:13 PM
Hi,

Quote
thought thats where you said an circled it to show where it gos?

No, thats how the screen button works.....your input just needs to call the CycleStart() function
AS IF the screen button is pressed. For an input signal to call a function the easiest, leanest
and most computationally efficient way of doing it is to have an entry in the signal library, thus
every time that the particular signal changes state it executes the function.

Craig
Title: Re: easy way i can make "Enable, Cycle start,ect" in mach 4 work with key stroke
Post by: jbraddock on July 01, 2018, 05:42:24 PM
Hi,

Quote
thought thats where you said an circled it to show where it gos?

No, thats how the screen button works.....your input just needs to call the CycleStart() function



OK where do i need to put it...,  DO I ADD TO CODE IN IT OR ERASE THAT CODE AN REPLACE WITH NEW CODE?