Skip to main content

Example - Ladder Diagram

MAX


The MAX instruction searches n number of WORD data registers, starting at S, for the maximum possible value. The result of the search is saved in 3 assigned data registers starting at D.

Ladder Diagram Example


When the contact, M0.0 is ON (1), the instruction finds the maximum WORD value of 4 data registers, D0, D1, D2, and D3.
The largest value found is saved in D5.
The position in which the data register was found is saved in D6.
The total amount of times the number is found is saved in D7.


Result

MAXP


The MAXP one-shot instruction searches n number of WORD data registers, starting at S, for the maximum possible value. The result of the search is saved in 3 assigned WORD data registers starting at D.
Every time this instruction executes, it energizes the output only once.

Ladder Diagram Example


When the contact, M0.1 is ON (1), the instruction finds the maximum WORD value of 5 data registers, D5, D6, D7, D8, and D9.
The largest value found is saved in D11.
The position in which the data register was found is saved in D12.
The total amount of times the number is found is saved in D13.


Result