+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.
+AxOpen.Timers.OnDelayTimer
+OnDelayTimer
class contains OnDelay
method, where logic of OnDelayTimer is implemented. OnDelay
method has following input:
+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:
+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;
+
+AxOpen.Timers.OffDelayTimer
+OffDelayTimer
class contains OffDelay
method, where logic of OffDelayTimer is implemented. OffDelay
method has following input:
+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:
+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;
+
+AxOpen.Timers.PulseTimer
+PulseTimer
class contains Pulse
method, where logic of PulseTimer is implemented. Pulse
method has following input:
+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:
+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;
+
+