20
« on: March 23, 2019, 07:43:18 AM »
Hi,
thanks Craig and Chad for reply. Yes I can make spindle warm up program in G code. That solves this problem. But I have the similar code in plc for turn on/off my grease pump and It also don't recognize the value of 30000 for turning on the pump. This code was working in build 3804. The dro counts only when machine is moving. Any idea how to make this code to wokr in another way? Here is the code:
local inst = mc.mcGetInstance()
local MotionLED = scr.GetProperty("MotionLED", "Value")
local droPumpCounter = scr.GetProperty("droPumpCounter", "Value")
local zero = 0
local hsig,rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7)
local Feed = mc.mcCntlFeedHoldState (inst)
local machEnbld = mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.OSIG_MACHINE_ENABLED))
--------------------------
if (MotionLED == "1") then
local droPumpCounterVar =(droPumpCounter + 1)
droPumpCounter = tostring(droPumpCounterVar)
scr.SetProperty("droPumpCounter", "Value",droPumpCounter)
end
if (droPumpCounter == "30000") then
mc.mcSignalSetState(hsig,1)
end
if (droPumpCounter == "30010") then
scr.SetProperty('droPumpCounter', 'Value', tostring(zero))
mc.mcSignalSetState(hsig,0)
end
--------------------------
if (machState == 0) then
scr.SetProperty("MotionLED", "Value", "0")
else
scr.SetProperty("MotionLED", "Value", "1")
if (Feed == 1) then
scr.SetProperty("MotionLED", "Value", "0")
end
end
Thanks,
Peter