User manual
Publication LOGIX-AP010B-EN-P - May 2010 77
Software Conversions Instructions Chapter 3
Arithmetic Operations
Arithmetic operations programmable in S5 can easily be converted to RSLogix
5000 software. The main difference between the two systems is that in S5
Statement List each operand is loaded into an accumulator before the
operation is performed and then the result can be transferred to the required
destination. The corresponding RSLogix 5000 Structured Text code is simpler
as it executes the operation on the operands directly. In S5 all operands for a
arithmetic operation must be of the same type (that is, 16 bit fixed point, 32 bit
fixed point or 32 bit floating point) but in RSLogix 5000 operands of other
types can be used in the same instruction.
The following RSLogix 5000 arithmetic operations have no corresponding
instruction in S5.
• MOD – Divides one operand by another and places the remainder in the
specified destination.
• ABS – Takes the absolute value of the source and places it in the
destination.
• CPT – Allows the programmer to define multiple arithmetic operations in
one instruction
The following RSLogix 5000 advance arithmetic operations have no
corresponding instruction in S5.
• LN – Computes the natural log of an operand and places it in the specified
destination.
• LOG – Computes the base 10 log of an operand and places it in the
specified destination.
• XPV – Computes the value of operand 1 (X) to the power of operand 2
(Y) and places the result in the specified destination.
S5 has increment (INC) and decrement (DEC) instructions that are used to
increment and decrement the value in the accumulator. RSLogix 5000 software
does not use the accumulator in the same way as S5 so this functionality can be
achieved with the add or subtract instructions in the RSLogix 5000 software.
Examples
The following examples illustrate how to convert the following arithmetic
functions from S5 to RSLogix 5000.
• Addition
• Subtraction
• Multiplication
• Division