Counter instructions are utilized in PLC programming to record the number of times an event happens. The following is a brief description of how a CODESYS counter instruction functions:
The CU input turns True & the Counter Value increase by 1 at t0.
At time t1, the output of the counter Q becomes True and the Counter Value equals the Preset Value.
At time t2, the output Q becomes False and the Counter Value is reset to 0 as a result of the RESET input becoming True.