Skip to main content

Example - Ladder Diagram

DDIV


The DDIV instruction divides a DWORD dividend value, S1, by a DWORD divisor value, S2, and saves the result in an assigned LWORD data register, D. The quotient is saved in the data register, D ~ D+1, and the remainder is saved in the data register, D+2 ~ D+3.

Ladder Diagram Example


When the contact, M0.0, is powered ON, the DWORD data register, D7, is divided by the DWORD data register, D9, and the result saved in the LWORD data register, D11.
The quotient is saved in data registers, D11 and D12, and the remainder is saved in data registers, D13 and D14.


Memory Monitor

DDIVP


The DDIVP one-shot instruction divides a DWORD dividend value, S1, by a DWORD divisor value, S2, and saves the result in an assigned LWORD data register, D. The quotient is saved in the data register, D ~ D+1, and the remainder is saved in the data register, D+2 ~ D+3.
Every time this instruction executes, it energizes the output only once.

Ladder Diagram Example


When the contact, M0.0, is powered ON, the DWORD data register, D7, is divided by the DWORD data register, D9, and the result saved in the LWORD data register, D11.
The quotient is saved in data registers, D11 and D12, and the remainder is saved in data registers, D13 and D14.


Memory Monitor