Count up CTU

Adds 1 each time the rung turns on. DN is on at PRE.

TagAfter two scans
BoxesPRE 12 ACC 1 CU 1 CD 0 DN 0 OV 0 UN 0

How it works

Adds 1 to ACC on each false-to-true rung change; holding the rung true does not count again. DN is 1 while ACC is at or above PRE.

How it's used

Use CTU to count events: parts past a sensor, presses of a button.

TagValue
PartEye1
PartsPRE 2 ACC 2 CU 1 CD 0 DN 1 OV 0 UN 0
BoxFull1

Two parts passed. Parts.DN turned BoxFull on.

Operands

OperandData typeRead or write
CounterCOUNTERReads and writes

Inside a COUNTER tag

MemberTypeMeaning
.PREDINTYou can write it
.ACCDINTRead only
.CUBOOLRead only
.CDBOOLRead only
.DNBOOLRead only
.OVBOOLRead only
.UNBOOLRead only

Common mistakes

  • Counting scans instead of eventsThis counter counts false-to-true transitions. A held true rung counts once.

Learn it in a lesson

Related