Skip to main content

Example - Ladder Diagram

CTR


The CTR instruction starts from 0 and counts up to the value v. If it is energized one more time, the count data register, CC, will reset to 0.

Ladder Diagram Example


The initial value of the BOOL counter data register, C3.0, is 0.
The initial value of the WORD current count data register, CC3.0, is 0.
The initial value of the WORD set count data register, CS3.0, is 6.



When the contact, M3.0, is powered ON (1), the counter instruction counts up by 1, increasing the current count data register, CC3.0, to 1.





When the contact, M3.0, is powered ON (1) again, the counter instruction counts up by 1, increasing the current count data register, CC3.0, to 5.




When the contact, M3.0, is powered ON (1) again, the counter instruction counts up by 1, increasing the current count data register, CC3.0, to 6.



Since CC3.0 is equal to CS3.0, the BOOL counter data register, C3.0, is set to 1.
As a result, the coil, Y3.0, is energized.



When the contact, M3.0, is powered ON (1) again, the counter instruction counts up by 1, resetting the current count data register, CC3.0, to 0.




When the contact, M3.1, is powered ON (1), the current count data register, CC3.0, is reset to 0.