Machsupport Forum
Mach Discussion => Mach4 General Discussion => Mach4 Toolbox => Topic started by: gadman58 on August 04, 2014, 08:30:00 PM
-
Add this code to PLC script.
if (inCycle == 1) then
local s = mc.mcCtrlGetRunTime(inst)/10;
local time = string.format("%.2d:%.2d:%.2d", s/3600, s/60%60, s%60);
scr.SetProperty('lblTime','Label', tostring(time));
end
Then add this code to the reset button so it zero's out on a reset.
scr.SetProperty('lblTime','Label', "00:00:00");
You will need a label on the screen so you have a place to put the text.
I copied the text just above it then just added a label for the time value.
I plan on looking to see how the M30 gets processed so I can add a parts counter and accumulated time of all the parts.
Glenn
-
great keep us posted... am wanting to add the same featurs but I'm having a lot of trouble figuring out Lua.
-
Hi,
Sorry that i have to reopen this topic, but i don´t get the Runtime Counter to work :( i have added the scripts to the PLC and the Reset button as above mentioned.
But how do i get the Readings to the Textbox? I don´t have any knowledge in Programming.