diff --git a/docfx/articles/timers/OFFDELAYTIMER.md b/docfx/articles/timers/OFFDELAYTIMER.md new file mode 100644 index 000000000..ad8176a1a --- /dev/null +++ b/docfx/articles/timers/OFFDELAYTIMER.md @@ -0,0 +1,53 @@ +# AxOpen.Timers.OffDelayTimer + +`OffDelayTimer` class contains `OffDelay` method, where logic of OffDelayTimer is implemented. `OffDelay` method has following input: + +```C# +VAR_INPUT + Parent : IAxoObject; // or IAxoContext, parent provides RTC implementation + inSignal : BOOL; // starts timer with falling edge, resets timer with rising edge + TimeDelay : LTIME; // time to pass, before output is set +END_VAR +``` + +The OffDelay method returns `output`, which *is FALSE, `TimeDelay` seconds after falling edge of `inSignal` is detected*. + +The `OffDelayTimer` have also public variables which can be used to access timer results: + +```C# +VAR PUBLIC + output : BOOL; // is FALSE, TimeDelay seconds after falling edge of inSignal is detected + elapsedTime : LTIME; // elapsed time +END_VAR +``` + + +The LOGIC of `OffDelayTimer` is following: + + +When `inSignal` is TRUE, `output` is TRUE and `elapsedTime` is 0. As soon as `inSignal` becomes FALSE, the time will begin to be counted in `elapsedTime` until its value is equal to that of `TimeDelay`. It will then remain constant. The `output` is FALSE when `inSignal` is FALSE and `elapsedTime` is equal to `TimeDelay`. Otherwise it is TRUE. Thus, `output` has a falling edge when the time indicated in `TimeDelay` has run out. + + +Example usage of `OffDelay` timer: + +``` +USING AXOpen.Timers; + + +VAR + _signal : BOOL; // input signal, which is set somewhere in application + _testTimerOffDelay: AXOpen.Timers.OffDelayTimer; // timer instance + _testTimeDelay: LTIME := LTIME#5s; // time delay +END_VAR + +// call OffDelay method somewhere in application +// THIS must type of IAxoObject +_testTimerOffDelay.OffDelay(THIS, _signal, _testTimeDelay); + +// check for output +IF(_testTimerOffDelay.output) THEN + + // handle result + +ENDIF; +``` \ No newline at end of file diff --git a/docfx/articles/timers/ONDELAYTIMER.md b/docfx/articles/timers/ONDELAYTIMER.md new file mode 100644 index 000000000..540c1f78d --- /dev/null +++ b/docfx/articles/timers/ONDELAYTIMER.md @@ -0,0 +1,51 @@ +# AxOpen.Timers.OnDelayTimer + +`OnDelayTimer` class contains `OnDelay` method, where logic of OnDelayTimer is implemented. `OnDelay` method has following input: + +```C# +VAR_INPUT + Parent : IAxoObject; // or IAxoContext, parent provides RTC implementation + inSignal : BOOL; // starts timer with rising edge, resets timer with falling edge + TimeDelay : LTIME; // time to pass, before output is set +END_VAR +``` + +The OnDelay method returns `output`, which *is TRUE, `TimeDelay` seconds after rising edge of `inSignal` is detected*. + +The `OnDelayTimer` have also public variables which can be used to access timer results: + +```C# +VAR PUBLIC + output : BOOL; // is TRUE, TimeDelay seconds after rising edge of inSignal is detected. + elapsedTime : LTIME; // elapsed time +END_VAR +``` + + +The LOGIC of `OnDelayTimer` is following: + +If `inSignal` is FALSE, `output` is FALSE and `elapsedTime` is 0. As soon as `input` becomes TRUE, the time will begin to be counted in `elapsedTime` until its value is equal to `TimeDelay`. It will then remain constant. The `output` is TRUE when `inSignal` is TRUE and `elapsedTime` is equal to `TimeDelay`. Otherwise it is FALSE. Thus, `output` has a rising edge when the time indicated in `TimeDelay` has run out. + +Example usage of `OnDelay` timer: + +``` +USING AXOpen.Timers; + + +VAR + _signal : BOOL; // input signal + _testTimerOnDelay: AXOpen.Timers.OnDelayTimer; // timer instance + _testTimeDelay: LTIME := LTIME#5s; // time delay +END_VAR + +// call OnDelay method somewhere in application +// THIS must type of IAxoObject +_testTimerOnDelay.OnDelay(THIS, _signal, _testTimeDelay); + +// check for output +IF(_testTimerOnDelay.output) THEN + + // handle result + +ENDIF; +``` \ No newline at end of file diff --git a/docfx/articles/timers/PULSETIMER.md b/docfx/articles/timers/PULSETIMER.md new file mode 100644 index 000000000..1ab63bfaf --- /dev/null +++ b/docfx/articles/timers/PULSETIMER.md @@ -0,0 +1,52 @@ +# AxOpen.Timers.PulseTimer + +`PulseTimer` class contains `Pulse` method, where logic of PulseTimer is implemented. `Pulse` method has following input: + +```C# +VAR_INPUT + Parent : IAxoObject; // or IAxoContext, parent provides RTC implementation + inSignal : BOOL; // Trigger for start of the pulse signal + PulseLenght : LTIME; // the length of the pulse signal +END_VAR +``` + +The Pulse timer returns output, which *is TRUE only during time counting*. It creates pulses with a defined pulse duration. + + +The `PulseTimer` have also public variables which can be used to access timer results: + +```C# +VAR PUBLIC + output : BOOL; // the pulse + elapsedTime : LTIME; // the current phase of the pulse +END_VAR +``` + + +The LOGIC of `PulseTimer` is following: + +If `inSignal` is FALSE, the `output` is FALSE and `elapsedTime` is 0. As soon as `inSignal` becomes TRUE, `output` also becomes TRUE and remains TRUE for the pulse duration `PulseLength`. As long as `output` is TRUE, the time is incremented in `elapsedTime`, until the value reaches PT. The value then remains constant. The `output` remains TRUE until the pulse duration has elapsed, irrespective of the state of the input `inSignal`. The `output` therefore supplies a signal over the interval specified in `PulseLength`. + +Example usage of `Pulse` timer: + +``` +USING AXOpen.Timers; + + +VAR + _signal : BOOL; // input signal, which is set somewhere in application + _testTimerPulse: AXOpen.Timers.PulseTimer; // timer instance + _testPulseLength: LTIME := LTIME#5s; // pulse length +END_VAR + +// call Pulse method somewhere in application +// THIS must type of IAxoObject +_testTimerPulse.Pulse(THIS, _signal, _testPulseLength); + +// check for output +IF(_testTimerPulse.output) THEN + + // handle result + +ENDIF; +``` \ No newline at end of file diff --git a/docfx/articles/timers/README.md b/docfx/articles/timers/README.md new file mode 100644 index 000000000..eb8fef6fe --- /dev/null +++ b/docfx/articles/timers/README.md @@ -0,0 +1,11 @@ +# AXOpen.Timers + +**AXOpen.Timers** provide implementations of basic timers used in PLC programming. Timers are implemented in separated classes within corresponding methods. +Functionality of Timers is based on *Real Time Clock* implementation provided from **AXContext**. + + +[!INCLUDE [OnDelayTimer](ONDELAYTIMER.md)] + +[!INCLUDE [OffDelayTimer](OFFDELAYTIMER.md)] + +[!INCLUDE [Pulse](PULSETIMER.md)] \ No newline at end of file diff --git a/docfx/articles/toc.yml b/docfx/articles/toc.yml index 057a67786..e4d78a1cd 100644 --- a/docfx/articles/toc.yml +++ b/docfx/articles/toc.yml @@ -49,6 +49,16 @@ items: - name: Installation href: ~/articles/security/INSTALLATION.md + +- name: AXOpen.Timers + href: ~/articles/timers/README.md + items: + - name: OnDelayTimer + href: ~/articles/timers/ONDELAYTIMER.md + - name: OffDelayTimer + href: ~/articles/timers/OFFDELAYTIMER.md + - name: Pulse + href: ~/articles/timers/PULSETIMER.md - name: Template themes href: ~/articles/themes/README.md - name: Template localization