Translations:Полезные программы/5/en — различия между версиями
Материал из WebHMI Wiki
(Новая страница: «-- checking condition ---------- if not startBit then tmrStartTime = now; -- save timer start WriteReg("TON_out", 0); -- timer output return 0 else…») |
|||
Строка 3: | Строка 3: | ||
tmrStartTime = now; -- save timer start | tmrStartTime = now; -- save timer start | ||
WriteReg("TON_out", 0); -- timer output | WriteReg("TON_out", 0); -- timer output | ||
+ | if curTmrState == 1 then | ||
+ | -- actions on 1 - 0 transition | ||
+ | end | ||
return 0 | return 0 | ||
else | else | ||
Строка 8: | Строка 11: | ||
-- actions upon timer trigger | -- actions upon timer trigger | ||
WriteReg("TON_out", 1) | WriteReg("TON_out", 1) | ||
+ | if curTmrState == 0 then | ||
+ | -- actions on 1 - 0 transition | ||
+ | end | ||
end -- if | end -- if | ||
end -- if | end -- if | ||
end -- main | end -- main | ||
</syntaxhighlight> | </syntaxhighlight> |
Версия 08:10, 3 мая 2018
-- checking condition ---------- if not startBit then
tmrStartTime = now; -- save timer start WriteReg("TON_out", 0); -- timer output if curTmrState == 1 then -- actions on 1 - 0 transition end return 0
else
if (now - tmrStartTime) > TIMER_DELAY then -- actions upon timer trigger WriteReg("TON_out", 1) if curTmrState == 0 then -- actions on 1 - 0 transition end end -- if
end -- if end -- main </syntaxhighlight>