CTU / CTUr

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Up counter.

Inputs

Input

Data Type

Range

Unit

Default

Description

CU

BOOL

 

 

 

Enable counting.

Counter is increased on each call when CU is TRUE.

PV

DINT

 

 

 

Programmed maximum value.

RESET

BOOL

 

 

 

Reset command.

Counter is reset to 0 when called with RESET to TRUE.

Outputs

Output

Data Type

Range

Unit

Description

CV

DINT

 

 

Current value of the counter.

Q

BOOL

 

 

TRUE when counter is full (i.e., when CV = PV).

Remarks

FBD Language

CtuFbd.gif (1380 octets)

FFLD Language

  • In the FFLD language, CU is the input rung.
    • The output rung is the Q output.

CtuLd.gif (1486 octets)

IL Language

(* MyCounter is a declared instance of CTU function block. *)
Op1: CAL    MyCounter (CU, RESET, PV)
FFLD     MyCounter.Q
ST     Q
FFLD     MyCounter.CV
ST     CV

ST Language

(* MyCounter is a declared instance of CTU function block. *)
MyCounter (CU, RESET, PV);
Q := MyCounter.Q;
CV := MyCounter.CV;

See Also