CTD_UDINT block

Short summary

Name

CTD_UDINT

→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/414781599/CTD_UDINT-version-1-modificationdate-1535022595545-api-v2.png

Available since

version 1.19.0 (for logi.CAD 3)

Functionality

The block is a down-counter (for UDINT values).

If there is a positive →edge at input CD, the counter is activated and decrements the counter value by 1. If input LD is →turned on, the counter value is reset to the initial value entered at PV. If the counter value reaches or falls below 0, output Q is set to value TRUE (or an equivalent). The decrementing is stopped, if the lower limit of UDINT (= value -0) is reached. Output CV returns the current counter value of the block.

In-/outputs


Identifier

→Data type

Description

Inputs:

CD

BOOL

decrement in case of positive edge

LD

BOOL

flag for reset to value of PV

PV

UDINT

initial value for counting

Outputs:

Q

BOOL

flag showing whether value 0 is reached or not

CV

UDINT

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.

Example for usage within ST-editor

PROGRAM Test
VAR
myCTD : CTD_UDINT;
StartCounter : BOOL;
RestartCounter : BOOL;
out : BOOL;
counter : UDINT;
END_VAR
myCTD(CD := StartCounter, LD := RestartCounter, PV := 10, Q => out, CV => counter);
(* Instance of block 'CTD_UDINT' is called: The counter is activated, when 'StartCounter' is 'TRUE'. The value for counting is reset to '10', when 'RestartCounter' is 'TRUE'. *)
(* 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.