Example - Ladder Diagram
DMAX
The DMAX instruction searches n number of DWORD data registers, starting at S, for the maximum possible value. The result of the search is saved in 4 assigned data registers starting at D.
Ladder Diagram Example
When the contact, M0.2 is ON (1), the instruction finds the maximum DWORD value of 4 data registers, D10, D12, D14, and D16.
The largest value found is saved in D19.
The position in which the data register was found is saved in D21.
The total amount of times the number is found is saved in D22.
Result
![]()
DMAXP
The DMAXP one-shot instruction searches n number of DWORD data registers, starting at S, for the maximum possible value. The result of the search is saved in 4 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.3 is ON (1), the instruction finds the maximum DWORD value of 3 data registers, D20, D22, and D24.
The largest value found is saved in D27.
The position in which the data register was found is saved in D29.
The total amount of times the number is found is saved in D30.
Result
![]()