Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Berti 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
-
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
-
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
-
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.