106
D320 PLC User's Manual
Instruction
Mnemonic
Division
Range
Bit
■
Word
DIV
DDIV
DIVB
DDIVB
Decimal division (DIV, DDIV)
BCD division (DIVB, DDIVB)
■
Double words
Ladder
D = S1
÷
S2
Decimal:
S1 = 18 and S2 = 3
Hexadecimal:
S1 = $12 and S2 = $03
DIV Example:
Decimal:
18
÷
3 = 6
DIVB Example:
BCD:
$12
÷
$03 = $04
Description
1. Divide the data in S1 by S2, then store the result in the D register.
2. When using DIV and DIVB, the calculation ranges are as follows:
S1: 0 to 65,535 ($0000 to $FFFF)
S2: 0 to 65,535 ($0000 to $FFFF)
D: 0 to 65,535 ($0000 to $FFFF)
3. When using DDIV and DDIVB, the calculation ranges are as follows:
S1: 0 to 4,294,976,295 (0 to $FFFFFFFF)
S2: 0 to 4,294,976,295 (0 to $FFFFFFFF)
D: 0 to 4,294,976,295 (0 to $FFFFFFFF)
4. The quotient is stored in the D register, and the remainder in special register SR22.
5. This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
Operation Results
Initial conditions: W0 = 00024 = $0018
W1 = 00002 = $0002
W2 = 00004 = $0004
W3 = 00001 = $0001
Operation results: W10 = 00006 = $0006
W11 = 00002 = $0002
W13 = 00004 = $0004
DIV
D =
S1 =
S2 =
R
R
DIVB
D =
S1 =
S2 =
DIV
D = W10
S1 = W0
S2 = W2
DDIV
D = W11
S1 = W0
S2 = W2
DIVB
D = W13
S1 = W0
S2 = W2
R0
R
Содержание D320 PLC
Страница 1: ...D320 PLC User s Manual...
Страница 18: ...6 D320 PLC User s Manual...
Страница 28: ...16 D320 PLC User s Manual...
Страница 34: ...22 D320 PLC User s Manual...
Страница 78: ...66 D320 PLC User s Manual...
Страница 176: ...164 D320 PLC User s Manual...
Страница 210: ...198 D320 PLC User s Manual...
Страница 258: ...246 D320 PLC User s Manual...