User manual

80 Publication LOGIX-AP010B-EN-P - May 2010
Chapter 3 Software Conversions Instructions
Subtraction
S5 uses three subtraction instructions depending on whether the operands are 16 bit integers, 32 bit integers or floating
point numbers. RSLogix 5000 software has one subtraction instruction that can be used regardless of the format of the
operands.
Note that you can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to
execute. You can check the S:V bit to see whether the rest was truncated.
Function S5 RSLogix 5000
Operand 1 (16 bit) FW18 data_word1
Operand 1 (32 bit) FD30
Operand 1 (floating point) FD42
Operand 2 (16 bit) FW20 data_word2
Operand 2 (32 bit) FD34
Operand 2 (floating point) FD46
Output (16 bit) FW22 data_word3
Output (32 bit) FD38
Operand (floating point) FD50
S5 Statement List
16 bit fixed point numbers
RSLogix 5000 Structured Text
LFW18
LFW20
-F
TFW22
data_word3 := data_word1 -
data_word2;
S5 Statement List
32 bit fixed point numbers
LFD30
LFD34
-D
TFD38
S5 Statement List
32 bit floating point numbers
LFD42
LFD46
-G
TFD50