Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: KatzYaakov on February 05, 2021, 06:53:53 AM
-
what is the best way to make timing for auto service(like run electric oil pump)
for example each 100 working h (h can be when Enable) force lubrication 1 minutes
thanks
yaakov
-
2 ways that are easy... You can do an on screen timer in screen edit mode OR you can make a PMC file. https://www.youtube.com/watch?v=jVhH9qyjjf0
-
please give me sample how do it with screen timer
,i didnt find any manual and i rea understand when you mean screen timer
-
Here is what I use.
You need to make a couple of registers also.
In PLC
-------------------------------------------------------
-- Cycle time label update
-------------------------------------------------------
--Requires a static text box named "CycleTime" on the screen
if (machEnabled == 1) then
local running = mc.mcCntlIsInCycle(inst)
if (running == 1) then
local cycletime = mc.mcCntlGetRunTime(inst, time)
scr.SetProperty("CycleTime", "Label", SecondsToTime(cycletime))
--run time
local hRun = mc.mcRegGetHandle(inst, 'iRegs0/RunningTime')
RunTime = cycletime
mc.mcRegSetValue(hRun, RunTime)
end
end
In PLC First Run section
---------------------------------------------------------
--Pop up message for maintenance
--Keep at bottom
---------------------------------------------------------
local MaintReg = mc.mcRegGetHandle(inst, 'iRegs0/MaintTime')
local MaintRegVal = mc.mcRegGetValue(MaintReg)
if (MaintRegVal >= 144000) then
mc.mcRegSetValue(MaintReg, 0.0)
wx.wxMessageBox("Please perform maintenance")
end
In the Cycle Start function in Screen Load Script
--Set time on Maintenance timer
local hMaint = mc.mcRegGetHandle(inst, 'iRegs0/MaintTime')
local MaintTime = mc.mcRegGetValue(hMaint)
local hRunning = mc.mcRegGetHandle(inst, 'iRegs0/RunningTime')
local RunningTime = mc.mcRegGetValue(hRunning)
MaintTime = (MaintTime + RunningTime)
mc.mcRegSetValue(hMaint, MaintTime)
mc.mcRegSetValue(hRunning, 0.0)
-
At the top of the screen in screen edit mode you can mouse over the icons. The 2nd one from the right looks like a stopwatch. That is an on screen timer object. Place that on the screen and you can use that to call your code at your intervals you would like.
-
brian its not angular meter?
-
It is in the newer versions I guess ..... I don't run old LOL
-
Where can download?
-
http://www.machsupport.com/ftp/Mach4/DevlopmentVersions/
Get the latest one. 4609, I believe
Steve