Hello Guest it is March 28, 2024, 05:12:48 AM

Author Topic: Start Cycle with a Push Button in Mach4  (Read 2683 times)

0 Members and 1 Guest are viewing this topic.

Start Cycle with a Push Button in Mach4
« 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
Ferdi
Re: Start Cycle with a Push Button in Mach4
« Reply #1 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.
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Start Cycle with a Push Button in Mach4
« Reply #2 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?

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Start Cycle with a Push Button in Mach4
« Reply #3 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
Re: Start Cycle with a Push Button in Mach4
« Reply #4 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
Re: Start Cycle with a Push Button in Mach4
« Reply #5 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
Re: Start Cycle with a Push Button in Mach4
« Reply #6 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.
 
Re: Start Cycle with a Push Button in Mach4
« Reply #7 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
Re: Start Cycle with a Push Button in Mach4
« Reply #8 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
Re: Start Cycle with a Push Button in Mach4
« Reply #9 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.