Hello Guest it is November 18, 2019, 09:13:17 AM

Author Topic: Mach4 Coolant Toogle Problems  (Read 810 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Coolant Toogle Problems
« on: September 21, 2018, 02:53:30 PM »
Hi. I got a big problem when setting up panel button to toggle coolant on/off.
I tried to do it in PMC Ladder, but every time Mach4 starts my water pump starts as well :(
Then I tried to to it in screen load script, and the same thing happen.

This is my script:

[mc.ISIG_INPUT38] = function (state)
if (state == 1) then
     local inst = mc.mcGetInstance();
     local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);
     local sigState = mc.mcSignalGetState(sigh);
     if (sigState == 0) then
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,1)
         mc.mcCntlSetLastError(inst, "Coolant On")
     else
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,0)
         mc.mcCntlSetLastError(inst, "Coolant Off")
     end
end
   
end,


Please help me. What is wrong with my script? And why is my functions in PMC running without me pushing my button?
Re: Mach4 Coolant Toogle Problems
« Reply #1 on: September 21, 2018, 05:56:07 PM »
Hi Soruud,
PMC works great for me here. I have  used it to setup all of my panel switches.
You could attach you PMC code and I will take a look at it.

Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.
Re: Mach4 Coolant Toogle Problems
« Reply #2 on: September 22, 2018, 02:32:12 AM »
Hi. I attached 2 of my attempts in an RAR file. I would very much like to try your PMC files. I guess it will be easy to adjust them for my setup.
Are you using Pokeys for buttons?

Re: Mach4 Coolant Toogle Problems
« Reply #3 on: September 22, 2018, 07:01:23 AM »
I will grab the files later tonight or tomorrow and post them.

Looking at your logic you are you using a closed contact (l\l )instead of an open contact (l l). If that doesn't match the wiring then it will start in the on position.

Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.

Offline thosj

*
  •  366 366
    • View Profile
Re: Mach4 Coolant Toogle Problems
« Reply #4 on: September 22, 2018, 10:56:47 AM »
Here are mine, M8 and M7, working from the screen start script Signal Library. You'd need to change the inputs, of course. I didn't compare to yours, but YOU can!


----------Mach4 Input 17 PoKeys Pin 17-----
----------Toggle Coolant M8----------------
[mc.ISIG_INPUT17] = function (state)
if (state == 1) then
     local inst = mc.mcGetInstance();
     local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);
     local sigState = mc.mcSignalGetState(sigh);
     if (sigState == 0) then
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,1)
         mc.mcCntlSetLastError(inst, "Coolant On")
     else
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,0)
         mc.mcCntlSetLastError(inst, "Coolant Off")
     end
end
   
end,

----------Mach4 Input 14 PoKeys Pin 14--
----------Toggle Mist M7----------------
[mc.ISIG_INPUT14] = function (state)
if (state == 1) then
     local inst = mc.mcGetInstance();
     local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON);
     local sigState = mc.mcSignalGetState(sigh);
     if (sigState == 0) then
         local OSigMist = mc.mcSignalGetHandle (inst,mc.OSIG_MISTON)
         mc.mcSignalSetState(OSigMist,1)
         mc.mcCntlSetLastError(inst, "Mist On")
     else
         local OSigMist = mc.mcSignalGetHandle (inst,mc.OSIG_MISTON)
         mc.mcSignalSetState(OSigMist,0)
         mc.mcCntlSetLastError(inst, "Mist Off")
     end
end
   
end,


Tom
Re: Mach4 Coolant Toogle Problems
« Reply #5 on: September 22, 2018, 03:20:21 PM »
Thank you very much. By the way it helped me to invert my contacts in PMC :)
Re: Mach4 Coolant Toogle Problems
« Reply #6 on: September 25, 2018, 06:15:43 AM »
As promised, here is my PMC file.

Let me know if it helps.
"NOTE: I renamed the file .pcm because it doesn't accept .pmc files ???

Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.
Re: Mach4 Coolant Toogle Problems
« Reply #7 on: January 03, 2019, 02:17:26 AM »
Hi,
I'm also interested in this feature!
How can I reverse the status at startup in Mach4?
because it lights up with M8 in the ON state.
The E-STOP button has no effect on the status.
Can the functions be deactivated when the E-STOP button is pressed?
Re: Mach4 Coolant Toogle Problems
« Reply #8 on: January 03, 2019, 06:23:30 AM »
Hi Daniba,
Are you asking about this in the PMC or the signal library?
In the PMC, if you want it to be turned off by the E-stop, then you have to make sure that there is an e-stop contact in the rung of logic that controls your M8 device.
To reverse it's starting status, use the opposite contact, open versus closed. Post your PMC file and I will take a look.

If it is the signal library, then someone else will have to chime in.

HTH

Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.
Re: Mach4 Coolant Toogle Problems
« Reply #9 on: January 03, 2019, 11:54:45 AM »
Hi,
I simply copied and pasted (modified only the pin) and inserted into the Mach4 script.
I tried to reverse the state, it has no effect.
It works, but starts with the ON state.
I am not able to use the PMC.