Skip to main content

Example - Ladder Diagram

SUM


The SUM instruction counts the set bits, the bits equal to 1, of the WORD value, S, and saves the amount of set bits in an assigned WORD data register, D.

Ladder Diagram Example


When the contact, M2.0 is ON (1), the instruction counts the set bits, all bits equal to 1, of the WORD data register, D0.
The result of the sum is saved in D2.


Memory Monitor

SUMP


The SUMP one-shot instruction counts the set bits, the bits equal to 1, of the WORD value, S, and saves the amount of set bits in an assigned WORD data register, D.
Every time this instruction executes, it energizes the output only once.

Ladder Diagram Example


When the contact, M2.1 is ON (1), the instruction counts the set bits, all bits equal to 1, of the WORD data register, D5.
The result of the sum is saved in D7.


Memory Monitor