User manual
Publication LOGIX-AP010B-EN-P - May 2010 91
Software Conversions Instructions Chapter 3
Conversion Operations
Siemens S5 uses the two’s complement system in which negative numbers are
represented by the two’s complement of the absolute value. The following
instructions change the sign of a 16 bit word and a 32 bit double word integer.
The RSLogix 5000 Negate (Neg) instruction performs the same function.
S5 Instruction Description
CSW Form two’s complement of ACCU 1-L (bits 0 to 15)
CSD Form two’s complement of ACCU1 (bits 0 to 31)
Negate
The following example shows how S5 changes the number sign in DW64 and places the result in DW78, and how the
equivalent functionality is achieved by using RSLogix software.
S5 RSLogix 5000
DW64 data_word1
DW78 data_word2
S5 Statement List
16 bit fixed point numbers
RSLogix 5000 Structured Text
LDW64
CSW
T DW78
data_word2 := -data_word1;
SIMATIC S5 - Ladder
RSLogix 5000 - Ladder