CTU block

Short summary

Name

CTU

→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/414781614/CTU-version-1-modificationdate-1535022659926-api-v2.png

Available since

version 1.4.1 (for logi.CAD 3)

Functionality

The block is an up-counter (for INT values).

If there is a positive →edge at input CU, the counter is activated and increments the counter value by 1. If input R is →turned on, the counter value is reset to value 0. Enter a limiting value at input PV. If this limiting value is reached or exceeded, output Q is set to value TRUE (or an equivalent). The incrementing is stopped, if the upper limit of INT (= value 32,767) 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

R

BOOL

flag for reset

PV

INT

limiting value

Outputs:

Q

BOOL

flag showing whether limiting value is reached or not

CV

INT

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
myCTU : CTU;
StartCounter : BOOL;
RestartCounter : BOOL;
out : BOOL;
counter : INT;
END_VAR
myCTU(CU := StartCounter, R := RestartCounter, PV := 10, Q => out, CV => counter);
(* Instance of block 'CTU' is called: The counter is activated, when 'StartCounter' is 'TRUE'. The value for counting is reset to '0', when 'RestartCounter' is 'TRUE'. *)
(* The limiting value for counting 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.