Hello Guest it is April 26, 2024, 12:46:47 AM

Author Topic: Mach combine fro rro to one feedrate potentiometer  (Read 582 times)

0 Members and 1 Guest are viewing this topic.

Mach combine fro rro to one feedrate potentiometer
« on: November 22, 2021, 05:12:57 PM »
Hallo together,

Is it possible to combine the rapid and the normal feed to one?
Because i would like to only use one potentiometer for both.
Thanks

Offline thosj

*
  •  532 532
    • View Profile
Re: Mach combine fro rro to one feedrate potentiometer
« Reply #1 on: November 22, 2021, 05:38:11 PM »
In a word, YES. There are probably several ways to do it.

Here's what I do. I have a PoKeys 57E which has two pins for analog inputs. Hooked up analog pots to those.

Wrote a file which is run from the PLC script.

This is what's in the file:

--Function to read value from analog register
function ReadRegister(device, analogPin)
    local inst = mc.mcGetInstance()
    local hreg = mc.mcRegGetHandle(inst, string.format("%s/Analog input %s", device, analogPin))
    return mc.mcRegGetValueString(hreg)
end

--Function to set FRO value
function SetFRO(analog)
    local percent = analog/1*250 --calculate percentage from 0% to 250%
    local inst = mc.mcGetInstance()
    mc.mcCntlSetFRO(inst, percent)
    mc.mcCntlSetRRO(inst, percent) --sets RRO 0% to 250% to follow FRO
end

--Main
local device = "PoKeys_24802" --Change this to the name of your PoKeys device
local analogPin = "45" --Analog input pin number

analogVal = ReadRegister(device, analogPin) --Save analog register value in variable
SetFRO(analogVal) -- Set FRO value in %



Here's what's at the end of my PLC script from the screen editor, it runs both an FRO/RRO and SRO script to do feed and speed with pots.

        -------------------------------------------------
        --My Stuff!!
        -------------------------------------------------
        --Runs the PoKeys FRO and SRO lua files as shown!
        --PoKeys Pin 44 is SRO
        --PoKeys Pin 45 is FRO
       
        dofile("C:\\Mach4Hobby\\Profiles\\ESS_New\\PoKeys_analog_FRO.lua")
        dofile("C:\\Mach4Hobby\\Profiles\\ESS_New\\PoKeys_analog_SRO.lua")
       
        --------------------------------------------------
        -------------------------------------------------------

Hopefully you can glean something here and come up with your own way.

Tom
--
Tom
Re: Mach combine fro rro to one feedrate potentiometer
« Reply #2 on: November 22, 2021, 05:55:56 PM »
Thanks Tom for your answer.
I have a axbbe board with two inputs too, but one is allready used for spindle speed...
So i have only one input left to use...

Lukas

Offline thosj

*
  •  532 532
    • View Profile
Re: Mach combine fro rro to one feedrate potentiometer
« Reply #3 on: November 24, 2021, 09:02:18 AM »
Should work, you only need one more for FRO/RRO. My two shown are one for speed, one for speed.

So however you got your speed to work, you should be able to get feed/rapid working the same way with the correct calls.
« Last Edit: November 24, 2021, 09:05:39 AM by thosj »
--
Tom