Skip to main content

7.3.4 TONR_TIME

Function

TONR_TIME is called a time accumulator, which can accumulate the state 1 signal of the input signal IN

LD graphics

alt text

  • Time accumulator timing diagram:

alt text

Parameter description

Interface variableDeclarationData typeDescription
INVar_InputBOOLStart input bit
PTVar_InputTIMESet time input
QVar_OutputBOOLOutput bit
ETVar_OutputTIMEElapsed time
RVar_OutputBOOLReset

Corresponding syntax

  • When the IN value changes from FALSE to TRUE, the timer starts
  • When the ET value is less than the PT value and the IN value is TRUE, ET continues to count. When the IN value is FALSE, ET immediately stops timing and keeps
  • When the ET value is equal to the PT value, the Q value outputs TRUE, ET stops timing and remains until IN becomes FALSE, and ET returns to 0
  • At any time, when R is TRUE, the Q output value is FALSE, and the ET value stops immediately and returns to 0. When R changes from TRUE to FALSE, if IN is TRUE at this time, the timer starts
Don’t forget the definition

Function block usage requires global declaration of an instance

Example

  • LD example is shown in the following animation:

alt text

  • ST example is shown in the following code:
TONR_TIME_1(
IN:=IN1,
R:=RESET,
PT:=T#2s,
Q=>OUT,
ET=>ET
);
IF OUT THEN
iVar:=iVar+1;
else
iVar:=0;
END_IF;