USING System.Counters;
PROGRAM SampleProgram
VAR_EXTERNAL
pushButton : BOOL;
light : BOOL;
END_VAR
VAR
count : CounterUp := (presetValue := 10);
END_VAR
VAR_TEMP
total : INT;
END_VAR
// increment counter by 1 for every push of the button
count(up := pushButton);
// pushButton created a rising edge 10 times
IF count.presetReached THEN
light := true;
END_IF;
END_PROGRAM