152 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 3 Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES)
Example: When limit_switch1 goes from cleared to set, CUEnable is set for one scan and
the CTUD instruction increments the ACC value by 1. When
ACC ≥ PRE, the DN parameter is set, which enables the function block
instruction following the CTUD instruction.
Structured Text
CTUD_01.Preset := 500;
CTUD_01.Reset := Restart;
CTUD_O1.CUEnable := limit_switch1;
CTUD(CTUD_01);
counter_state := CTUD_01.DN;
Function Block