Hello Guest it is September 21, 2021, 06:28:39 AM

Author Topic: PMC. Need help to toggle an output  (Read 903 times)

0 Members and 1 Guest are viewing this topic.

PMC. Need help to toggle an output
« on: September 24, 2018, 04:05:30 PM »
Hi. I need help to make my external panel button toggle an Mach4 output. This is for Airblow. I already used the M07 for Mist.
I would prefer to do this in PMC, but can do it in LUA too. Just need some help to make it work.

My button is at my Pokeys pin 40, and my Mach4  Output is 11.  (For LUA solution my button will be mapped to Mach4 input 40)
In G-code I just use M111 (ON) and M211 (OFF), so I just need to make it work on external button for override.

Can someone please help me type a LUA script or attach an PMC file for me ???

By the way.. Is it possible to make PMC run an M-code? If so please show me how. That would end my problem  :)

I would also like to do my FeedRate Override and Spindle speed +-10% buttons in PMC if possible. Today I am doing this in Pokeys Pedant, and it kinda sux.

Thanx :)
« Last Edit: September 24, 2018, 04:09:58 PM by soruud »
Re: PMC. Need help to toggle an output
« Reply #1 on: September 24, 2018, 04:43:15 PM »
You started the thread on the coolant toggle.  It will be similar to that for your air blow.
Just have your m111 turn on the output and m222 turn it off.  

For your button override, just have it check the state of the air blow.  If on then turn off; if off then turn on.  This will go in your signal script.

I don't use the PMC so someone else will have to answer about running an M code from the PMC. 

Chad Byrd
Re: PMC. Need help to toggle an output
« Reply #2 on: September 24, 2018, 07:12:27 PM »
As far as the FRO and SSO.  I plan on adding panel buttons to a lathe to adjust the FRO and SSO so I went ahead and worked on some code to do this.

--FRO is read from 0 - 250
--FRO + 10%
function FROPlus()
    local inst = mc.mcGetInstance()
    local FRO = mc.mcCntlGetFRO(inst)
    if FRO == 250 then
       mc.mcCntlSetLastError(inst, "Can't increase FRO anymore.")
    else
       local NewFRO = (FRO + 10)
       mc.mcCntlSetFRO(inst, NewFRO)
    end
end

--FRO is read from 0 - 250
--FRO - 10%
function FROMinus()
    local inst = mc.mcGetInstance()
    local FRO = mc.mcCntlGetFRO(inst)
    if FRO == 0 then
       mc.mcCntlSetLastError(inst, "Can't decrease FRO anymore.")
    else
       local NewFRO = (FRO - 10)
       mc.mcCntlSetFRO(inst, NewFRO)
    end
end

These are functions I made to increase and decrease the FRO by 10%.
You can add the function to a button in the signal script.  
Again, much like the coolant toggle discussion, just add this function into the signal.

The Spindle Override will read from 0.5 - 1.5.  So when you make the Script for them, just make it SSO = 1.5 and SSO = 0.5  and increase and decrease by 0.1

You can also have a "Reset FRO" and a "Reset SSO" button to set it back to 100%.
Just use the Set command and set it to FRO 100 and SSO 1
 
« Last Edit: September 24, 2018, 07:14:53 PM by Cbyrdtopper »
Chad Byrd