Chaoticone, DazTheGas
I wrote an LCD initialize function in the Screen load script. Guys thanks for all your suggestions, hopefully this will help anyone else attempting to get an LCD to work with a pokeys device.
Russ
--------------------------------------------------------------
-- Yaskawa Pendant Clear LCD Display
--------------------------------------------------------------
function YPenLCD()
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_32062/LCD Line 1"))
mc.mcRegSetValueString(hreg, "X: 0.0000 ") -- X zero display
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_32062/LCD Line 2"))
mc.mcRegSetValueString(hreg, "Y: 0.0000 ") -- Y zero display
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_32062/LCD Line 3"))
mc.mcRegSetValueString(hreg, "Z: 0.0000 ") -- Z zero display
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_32062/LCD Line 4"))
mc.mcRegSetValueString(hreg, "A: 0.0000 ") -- A zero display
end
Then I added a function call in the PLC script that runs one time. This basically clears the screen and shows each axis set at 0.0000, and if something other than 0.0000 was saved when you exit Mach4 it updates that when the machine comes up so this is working much better. I can probably clean up the xDRO update scripts and do all of that in the screen load script as Daz suggested as well.
for name,number in pairs (DROTable) do -- for each paired name (key) and number (value) in the DRO table
local droName = (DROTable[name]) -- make the variable named droName equal the name from the table above
--wx.wxMessageBox (droName)
local val = mc.mcProfileGetString(inst, "PersistentDROs", (droName), "NotFound") -- Get the Value from the profile ini
if(val ~= "NotFound")then -- If the value is not equal to NotFound
scr.SetProperty((droName), "Value", val) -- Set the dros value to the value from the profile ini
end -- End the If statement
end -- End the For loop
---------------------------------------------------
YPenLCD() -- initialize the Yaskawa LCD display when you first start.
end
-------------------------------------------------------