Got 4 meters working great. Key was that the CNC4PC configuration setup for the Pokeys57E already has registers going for the 4 analog inputs.
I realized that the pin setups were correct once I could see the voltages active in the reg diagnostics for the Pokeys device in Mach4.
Next, with help of the LUA Scripting Guide showing how to read register values, I read each value using the following function placed in the Screen load script.
The labels used to access the registry were listed in the registry diagnostics "CNC4PCMotionDevice" and the name of each input "Analog input 41" was there too.
function ReadAnalog(regname)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("CNC4PCMotionDevice/%s", regname))
return mc.mcRegGetValueString(hreg)
end
Then in the PLC script I put a pair of lines for each of the 3 meters changing the values 41,42,43,44 or the Pokeys pins for each analog input. Each meter was setup in the screen with labels Meter1, Meter2, Meter3 etc.
regval=ReadAnalog("Analog input 41")
scr.SetProperty("Meter1","Value",regval)
The PLC is now updating the meters realtime but I put it all in a do loop if (machEnabled == 1) then update the meters so it only updates when Mach is enabled.
Happy now!