Hello Guest it is December 03, 2024, 03:02:32 AM

Author Topic: Lua Script and reading register's Help  (Read 6837 times)

0 Members and 1 Guest are viewing this topic.

Offline gorf23

*
  •  189 189
Re: Lua Script and reading register's Help
« Reply #20 on: February 02, 2021, 04:49:34 PM »
Thanks Brian

Would i use the PLC script or the screen load script I'm assuming the PLC

Gary
Re: Lua Script and reading register's Help
« Reply #21 on: February 02, 2021, 05:18:41 PM »
You got it! 8)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline gorf23

*
  •  189 189
Re: Lua Script and reading register's Help
« Reply #22 on: February 02, 2021, 05:32:06 PM »
Thanks Brian

This seems to work look ok to you.. no problems down the road?
its in the PLC script

Code: [Select]
if (pluginState == 0) and (scr.IsLoaded()) then
PluginReg = 0
ProbeState = 0
local Ereg  = mc.mcRegGetHandle(inst,"ESS/Connected")
local Preg = mc.mcRegGetHandle(inst,"PoKeys_40548/DeviceConnected")
if (mc.mcRegGetValue(Preg) == 1) then
     pluginReg  = mc.mcRegGetHandle(inst,"PoKeys_40548/ProbeStatus")
ProbeState = -4
      elseif (mc.mcRegGetValue(Ereg) == 1) then
       pluginReg  = mc.mcRegGetHandle(inst,"ESS/Probing_State")
   ProbeState = -1
end
pluginState = 1
end

Thanks gary
Re: Lua Script and reading register's Help
« Reply #23 on: February 02, 2021, 06:20:23 PM »
yup that will be fine
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com