21
Mach4 General Discussion / Spindle warm
« on: March 22, 2019, 05:24:22 PM »
Hello,
today I've updated mach4 to version build 4124 and I have some problem with the code in plc script. This code was working just fine with version build 3804. It's a code to warm up my spindle. It activates this code by pressing button to activate the led to start the timer dro and set the spindle rpm to 6000 for 4minutes. The rest of the code is in plc. With new update this code in plc doesent work when dro reads value of 4000, 8000 and 12000. Can someone please help me make it work again. Thanks.
PLC code:
local inst = mc.mcGetInstance()
local zero = 0
local SpindleWarmStartLED = scr.GetProperty("SpindleWarmStartLED", "Value")
local droSpindleWarm = scr.GetProperty("droSpindleWarm", "Value")
local machEnbld = mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.OSIG_MACHINE_ENABLED))
if (SpindleWarmStartLED == "1") then
local droSpindleWarmVar =(droSpindleWarm + 1)
droSpindleWarm = tostring(droSpindleWarmVar)
scr.SetProperty("droSpindleWarm", "Value",droSpindleWarm)
end
if (droSpindleWarm == "4000") then
mc.mcSpindleSetDirection(inst, 1);
mc.mcSpindleSetCommandRPM(inst, 12000);
end
if (droSpindleWarm == "8000") then
mc.mcSpindleSetDirection(inst, 1);
mc.mcSpindleSetCommandRPM(inst, 18000);
end
if (droSpindleWarm == "12000") then
scr.SetProperty('droSpindleWarm', 'Value', tostring(zero))
scr.SetProperty("SpindleWarmStartLED", "Value", "0")
mc.mcSpindleSetDirection(inst, 0);
mc.mcSpindleSetCommandRPM(inst, 0);
end
if (machEnbld == 0) then
scr.SetProperty("SpindleWarmStartLED", "Value", "0")
mc.mcSpindleSetCommandRPM(inst, 0);
end
today I've updated mach4 to version build 4124 and I have some problem with the code in plc script. This code was working just fine with version build 3804. It's a code to warm up my spindle. It activates this code by pressing button to activate the led to start the timer dro and set the spindle rpm to 6000 for 4minutes. The rest of the code is in plc. With new update this code in plc doesent work when dro reads value of 4000, 8000 and 12000. Can someone please help me make it work again. Thanks.
PLC code:
local inst = mc.mcGetInstance()
local zero = 0
local SpindleWarmStartLED = scr.GetProperty("SpindleWarmStartLED", "Value")
local droSpindleWarm = scr.GetProperty("droSpindleWarm", "Value")
local machEnbld = mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.OSIG_MACHINE_ENABLED))
if (SpindleWarmStartLED == "1") then
local droSpindleWarmVar =(droSpindleWarm + 1)
droSpindleWarm = tostring(droSpindleWarmVar)
scr.SetProperty("droSpindleWarm", "Value",droSpindleWarm)
end
if (droSpindleWarm == "4000") then
mc.mcSpindleSetDirection(inst, 1);
mc.mcSpindleSetCommandRPM(inst, 12000);
end
if (droSpindleWarm == "8000") then
mc.mcSpindleSetDirection(inst, 1);
mc.mcSpindleSetCommandRPM(inst, 18000);
end
if (droSpindleWarm == "12000") then
scr.SetProperty('droSpindleWarm', 'Value', tostring(zero))
scr.SetProperty("SpindleWarmStartLED", "Value", "0")
mc.mcSpindleSetDirection(inst, 0);
mc.mcSpindleSetCommandRPM(inst, 0);
end
if (machEnbld == 0) then
scr.SetProperty("SpindleWarmStartLED", "Value", "0")
mc.mcSpindleSetCommandRPM(inst, 0);
end