CTU_FUN

Up counter

This is a user-defined function from a system function block. CTU_FUN (count up) allows you to program counting procedures.

Counting up starts at zero until the maximum value 32767 is reached. Each rising edge at count up CU increases the value at current value CV by 1.

Parameters

Input

CU (BOOL)

count up

the value 1 is added to CV for each rising edge at CU, except when Reset is set

Reset (BOOL)

Reset

A rising edge at Reset resets the currrent value CV to zero and counting stops. The output Q is set to FALSE.

The next falling edge at Reset restarts counting.

PV (INT)

Preset value

if CV is equal/greater than PV, Q is set to TRUE

If no preset value is set or the preset value is zero, the output Q is set to TRUE immediately after counting starts.

Input/output

dutInstance(CTU_FUN_INSTANCE_DUT)

Internal memory containing the internal values and states, which corresponds to the instance memory of the associated FB.

Output

Q (BOOL)

signal output

is set to TRUE if CV is greater than/equal to PV

is set to FALSE if a rising edge is detected at Reset

CV (INT)

Current value

  • contains the addition result

  • If CV reaches the preset value PV, the output Q is set to TRUE, but counting continues until the maximum limit 32767 is reached.

  • The value can be changed during counting operation by writing to the variable from the programming editor.

Time chart

Related topics:

Modified on: 2021-03-30Feedback on this pagePanasonic hotline