Navigation:  Equipments (Devices) > CFW100 > Ladder > Counter >

CTU

Count Up Counter

Previous pageReturn to chapter overviewNext page

Block for gradual count of input pulses.

 

Ladder Representation

 

CTU_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

CU

BOOL

Pulse identifier

R

BOOL

Loads the zero value in CV

PV

WORD UINT

Maximum count value

VAR_OUTPUT

Q

BOOL

Counter overrun flag

CV

WORD UINT

Current count value

VAR

CTU_INST_0

CTU

Instance of access to block structure

 

 

wpshelp_common_fig_note

NOTE!

 

Some devices allow you to configure user parameters, but these need to be configured for use in the fields PV and CV, where it is necessary to select a compatible data type (WORD or UINT). For more information refer to the corresponding topic.

 

Operation

 

When this block identifies a leading edge in CD, it increments the CV variable until it is equal to PV. While CV equals PV, the output Q remains at TRUE level. By detecting high-level R, the block loads the zero value in CV.

 

Block Flowchart

 

CTU_flowchart

 

Operation Diagram

 hardwarecounterctu_fig2

 

Example in Ladder

 

CTU_example01

 

The above example shows the initial conditions of routine. Since CV has a lower value than of PV, the Q output is disabled.

 

CTU_example02

 

At each leading edge identified in CU, the value of CV is incremented until it reaches the PV value, when the Q output is enabled.

 

CTU_example03

 

By identifying TRUE level in R, the block loads the zero value to CV. Since this value is lower than of PV, the Q output is disabled.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   PRESET : UINT := 30;

   COUNT : UINT;

   CTU_INST_0 : FB_CTU;

END_VAR

 

CTU_INST_0.CU := DI1;

CTU_INST_0(R:=DI2, PV:=PRESET);

COUNT := CTU_INST_0.CV;

DO1 := CTU_INST_0.Q;