Arithmetic instructions
429
Part III FP Instructions
F87_ABS
16-bit data absolute value
The absolute value of the 16-bit data with +/- sign is stored in d. This instruction is useful for
handling data whose sign (+/-) may vary.
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
Instead of using this FP instruction, we recommend using the related IEC instruction ABS (see
page 66). Please refer also to Advantages of the IEC instructions in the online help.
PLC types
Availability of F87_ABS (see page 1326)
Variable Data type Function
d ANY16 16-bit area for storing original data and its absolute value
For Relay T/C Register Constant
d - WY WR WL SV EV DT LD FL -
No. IEC address Set If
R9007 %MX0.900.7 permanently
R9008 %MX0.900.8 for an instant
the 16-bit data is the negative minimum
value -32768 (16#8000).
R9009 %MX0.900.9 for an instant the 16-bit data is the negative value in
the range from -1 to -32767 (16#FFFF to
16#8001).
Description
Gets the absolute value of 16-bit data with the sign specified by d if the trigger EN is in the
ON-state.
Data types
Operands
Error flags
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start is set to TRUE, the function is carried out.