
Chapter 6: Instructions
109
Instruction
Command
Subtraction with Carry
Range
Bit
■
Word
SBC
DSBC
SBCB
DSBCB
Decimal subtraction with carry
(SBC, DSBC)
BCD subtraction with carry
(SBCB, DSBCB)
■
Double word
Ladder
D = S1 - S2 - carry
Decimal:
S1 = 34 and S2 = 19
Hexadecimal:
S1 = $22 and S2 = $13
Carry Flag:
F1.8 = On
SBC Example:
Decimal:
34 - 19 - 1 = 14
SBCB Example:
BCD:
$22 - $13 - $01 = $08
Description
1. Subtract the data in S2 from S1. If the carry flag F1.8 is On, subtract 1. Then store the result
in the D register.
2. When using SBC and SBCB, 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 DSBC and DSBCB, 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. If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On.
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.
SBC
D =
S1 =
S2 =
R
R
SBCB
D =
S1 =
S2 =
Содержание 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...