Hello Guest it is October 21, 2021, 11:30:51 PM

Author Topic: Pokeys57E,Mach4 External Push Button  (Read 6347 times)

0 Members and 1 Guest are viewing this topic.

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Pokeys57E,Mach4 External Push Button
« on: April 23, 2016, 12:05:55 PM »
Hello,
 Does anyone have an example of how to configure Mach4&Pokeys57E plugin for a External Push button or switch? Example: I have Pokeys pin 28 set as Digital Input, which is wired to my Cycle Start button. How do you configure plugin and Mach4 so Mach4 knows this input is Cycle Start?

Thanks,
Troy
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline NeoTO

*
  •  504 504
    • View Profile
    • PoLabs
Re: Pokeys57E,Mach4 External Push Button
« Reply #1 on: April 25, 2016, 04:29:48 PM »
Hi, Troy

Please follow the tutorial on our blog page: http://blog.poscope.com/mach4-tutorial-custom-signal-mapping/

Regards,
Matevž
www.poscope.com home of PoKeys USB HID, IO, USB, Ethernet controler and PoScope USB PC oscilloscope

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Re: Pokeys57E,Mach4 External Push Button
« Reply #2 on: April 26, 2016, 07:14:40 AM »
Hello Matevz,
 That looks great :) I will reply back here with results.
Thanks again,
Troy
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Re: Pokeys57E,Mach4 External Push Button
« Reply #3 on: April 26, 2016, 03:43:14 PM »
Ok. Tutorial worked great, as Cycle Start button is now working. Thought i could use this tutorial for all my other inputs by copying the code for CycleStart and just change the ISIP input and the CycleStart() like below for CycleStop....

[mc.ISIG_INPUT27] = function (state)
if (state == 1) then   
        CycleStop()
    end

but did not work.

I have more external buttons and switches to add like the CycleStart, is there a list or literature i should be referring to for the LUA script and Mach4 commands? Iam only somewhat familiar with Mach3 and the OEM codes in VisualBasic. Any help is much appreciated.
Thanks,
Troy
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Pokeys57E,Mach4 External Push Button
« Reply #4 on: April 26, 2016, 07:52:10 PM »
there is a Mach4 programming manual in the manual folder in the Mach4 folder on your C drive

you will have to make a table

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Re: Pokeys57E,Mach4 External Push Button
« Reply #5 on: April 27, 2016, 11:03:33 AM »
I read the manual and found a short description of a Table, but not enough info for me on how to make one or where to place it and how to use it. Is there a example on how to make one for adding more inputs for physical external buttons and switches?
« Last Edit: April 27, 2016, 11:05:06 AM by TDAY »
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline NeoTO

*
  •  504 504
    • View Profile
    • PoLabs
Re: Pokeys57E,Mach4 External Push Button
« Reply #6 on: April 27, 2016, 12:10:42 PM »
If you look at the code in the script, you will notice that you have somewhere in the beginning

Code: [Select]
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {

Then, one block as following for each signal

Code: [Select]
[mc.<signal name>] = function (state)
 < code >
end

So, SigLib is a Table name, which contains handler functions for all signals in the list. The SigLib ends somewhere later on (around row 70) with a '}'
To add a new signal handler, make sure that you insert it in the Table and that you put a comma at the end of it.

Code: [Select]
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.SIGNAL1] = function (state)
 < code >
end,
[mc.SIGNAL2] = function (state)
 < code >
end,
[mc.SIGNAL3] = function (state)
 < code >
end,
...

[mc.SIGNALn] = function (state)
 < code >
end
}



« Last Edit: April 27, 2016, 12:37:48 PM by NeoTO »
www.poscope.com home of PoKeys USB HID, IO, USB, Ethernet controler and PoScope USB PC oscilloscope

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Re: Pokeys57E,Mach4 External Push Button
« Reply #7 on: April 27, 2016, 03:59:22 PM »
Here is what i tried to do for CycleStop....
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline TDAY

*
  •  165 165
    • View Profile
    • Home CNC Stuff
Re: Pokeys57E,Mach4 External Push Button
« Reply #8 on: April 27, 2016, 04:01:02 PM »
But when i press the external cycle stop during a Gcode MDI run i get the following error.....
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Pokeys57E,Mach4 External Push Button
« Reply #9 on: April 27, 2016, 04:08:04 PM »
have it in it's own section the end end stops the table and state 1 on, state 0 off