Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Ferdi270343 on January 28, 2021, 09:48:49 AM

Title: Start Cycle with a Push Button in Mach4
Post by: Ferdi270343 on January 28, 2021, 09:48:49 AM
Hi!
I want to Start Cycle with a Push Button instead clicking with the mouse in the yellow label on the screen of Mach4.
Where I must connect the two wires coming from the Push Button
Title: Re: Start Cycle with a Push Button in Mach4
Post by: Brian Barker on January 29, 2021, 08:09:53 AM
You can set it up as an input. Check in the logging that it is working. After that you will need to edit the Signal script table in the screen load script (this is done in edit mode of the screen). You will see an example of the code you need in the script  with it rem'd out.  Sounds hard but it will be simple to walk you through it.
Title: Re: Start Cycle with a Push Button in Mach4
Post by: stevehuck on August 22, 2021, 01:04:09 PM
I am looking at the same thing here and have followed what you have said. I tried editing the file to associate input 0 with a cycle start. I edit the example but i get an error and I am unable to save the file. Access denied.

Sorry if this is a dumb question but this is my first week with Mach4

PS I do have the button press show up on the diagnostic screen so I believe this is the last step?
Title: Re: Start Cycle with a Push Button in Mach4
Post by: smurph on August 24, 2021, 06:56:02 PM
The PMC is a GRAND tool to use to accomplish this task.

A one rung ladder consisting of a contact(mapped to an input of your coosing) to a one shot rising to a core action coil (cycle start).

Steve
Title: Re: Start Cycle with a Push Button in Mach4
Post by: peter g on August 26, 2021, 01:42:26 PM
I used this code to use an external button to cycle start. I also have one for cycle stop and feed hold.
Code below:

-------------------------------Cycle Start-------------------------------

[mc.ISIG_INPUT16] = function (state)      --If you are not using INPUT16 for Cycle Start change it.
    InputCycleStart()
    end,

---------------------------------------------------------------
-- The Input Signal for a Cycle Start Occurred.
---------------------------------------------------------------

function InputCycleStart()
    CycleStart()
    mc.mcCntlSetLastError(inst, "Cycle Start")
end
Title: Re: Start Cycle with a Push Button in Mach4
Post by: KatzYaakov on August 26, 2021, 03:44:24 PM
PMC only ,after some years with mach not few machines ,believe me PMC its only option for external button
Title: Re: Start Cycle with a Push Button in Mach4
Post by: stevehuck on September 01, 2023, 03:06:28 PM
I know this is an old topic but I have to reserect it. My computer died that ran my mill. I have a new computer running Mach4 for my lathe. While configuring my network I wiped out my lathe setup. So starting from scratch I had to...

Setup 2 smooth steppers on seperate ethernet ports for 2 different machines. Got that set

Setup and configure the mill from scratch, ports pins Ect!

Mill is running and e stop is working and now CYCLE START button! Yes sir. I did this a few years ago and cant remember what I did. I tried to edit out the cycle Start lines in the screenScript file but it wont allow me to save it. Opens in read only blah blah. I looked at PMC and created the line with the button and core output. Made it input0 and cycle start. Simulated and it did nothing. I'm pretty sure the button is working. In diagnostics Input 0 lights when i push the button and the key press is recorded in the logging facility when pressed as well as let go. SO!

Can anybody tell me how to open the screenscript file so it can be edited? Im pretty sure thats how I got it working last time.

Does anybody know how the PMC editor works? Be nice to figure it out for future use.
 
Title: Re: Start Cycle with a Push Button in Mach4
Post by: stevehuck on September 01, 2023, 04:30:23 PM
Believe it or not I remembered how to edit the screen load. So tomorrow im going to put this in place of the example that is remmed out. Does this look correct? My button is Input zero. If thats the case I can setup the lathe and go through all this again tomorrow.


[mc.ISIG_INPUT0] = function (state)   
    InputCycleStart()
end,

function InputCycleStart()
    CycleStart()
    mc.mcCntlSetLastError(inst, "Cycle Start")
end
Title: Re: Start Cycle with a Push Button in Mach4
Post by: menardmfg on September 02, 2023, 11:16:18 AM
If you go to newfangled’s web page and go to the blog. You will find there is a very in-depth description of how to do this. I asked a long time ago and I think it was Brian who put it up there. Check it out
Art
Title: Re: Start Cycle with a Push Button in Mach4
Post by: stevehuck on September 02, 2023, 12:20:05 PM

I just checked the blog and that is exactly what I did. It's been 2 years so it took a while before I remembered how to do it.



Changed from this....


[mc.ISIG_INPUT1] = function (state) -- this is an example for a condition in the signal table.
--   if (state == 1) then   
--       CycleStart()
--   else
--       mc.mcCntlFeedHold (0)
--   end

end,


To this.....


[mc.ISIG_INPUT0] = function (state) -- this is an example for a condition in the signal table for input zer0.
   if (state == 1) then   
       CycleStart()
   end
end,


Now both the mill and lathe have working cycle start buttons.
Title: Re: Start Cycle with a Push Button in Mach4
Post by: menardmfg on September 03, 2023, 11:08:38 AM
Yup, that is a great step by step set of directions. I think Steve’s method may be more responsive (sometimes there seems to be a bit of a delay). I wish there was a better description of how to use the PMC. I’m currently running a Hardinge CHNC with Mach 4 industrial. The support from NFS has been phenomenal. Been running for about a year now running production parts with no issues. Thank you everyone on the support team.
Art
Title: Re: Start Cycle with a Push Button in Mach4
Post by: stevehuck on September 07, 2023, 05:45:03 PM
Just wanted to come back and say thanks. Mill ran a dozen parts and was flawless. Acted exactly as I wanted it to. Thank you for all your help.