CTUD_ULINT block

Short summary

Name

CTUD_ULINT

→POU type

→function block

Category

IEC-block, Counter

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/check.svg no restrictions

Graphical interface

images/download/thumbnails/414781681/CTUD_ULINT-version-1-modificationdate-1535023088037-api-v2.png

Available since

version 1.19.0 (for logi.CAD 3)

Functionality

The block is an up- and down-counter (for ULINT values).

If there is a positive →edge at input CU, the counter is activated and increments the counter value by 1. If there is a positive edge at input CD, the counter is activated and decrements the counter value by 1.
If input R is →turned on, the counter value is reset to value 0. If input LD is turned on, the counter value is reset to the value entered at PV. If this value is reached or exceeded when counting up, output QU is set to value TRUE (or an equivalent). If the counter value reaches or falls below 0 when counting down, output QD is set to value TRUE (or an equivalent).
The incrementing is stopped, if the upper limit of ULINT (= value 18,446,744,073,709,551,615) is reached. The decrementing is stopped, if the lower limit of ULINT (= value 0) is reached.
Output CV returns the current counter value of the block.

In-/outputs


Identifier

→Data type

Description

Inputs:

CU

BOOL

increment in case of positive edge

CD

BOOL

decrement in case of positive edge

R

BOOL

flag for reset to value 0

LD

BOOL

flag for reset to value of PV

PV

ULINT

limiting value for counting up

Outputs:

QU

BOOL

flag showing whether limiting value is reached or not

QD

BOOL

flag showing whether value 0 is reached or not

CV

ULINT

current counter value

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
VAR
myCTUD : CTUD_ULINT;
StartUpCnt : BOOL;
StartDownCnt : BOOL;
ResettoZero : BOOL;
ResettoValueOnPV : BOOL;
outUp : BOOL;
outDown : BOOL;
counter : ULINT;
END_VAR
myCTUD(CU := StartUpCnt, CD := StartDownCnt, R := ResettoZero, LD := ResettoValueOnPV, PV := 10, QU => outUp, QD => outDown, CV => counter);
(* Instance of block 'CTUD_ULINT' is called: The up-counter is activated, when 'StartUpCnt' is 'TRUE'. The down-counter is activated, when 'StartDownCnt' is 'TRUE'. *)
(* The value for counting is reset to '0', when 'ResettoZero' is 'TRUE'. It is reset to '10', when 'ResettoValueOnPV' is 'TRUE' *)
(* The limiting value for counting up is '10'. *)
(* Appropriate variables access the outputs. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.