ABS: Form absolute value (S7-1200, S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
ABS: Form absolute value

Description

You can use the "Form absolute value" instruction to calculate the absolute value of the value specified at input IN. The result of the instruction is output at the OUT output and can be queried there.

The enable output ENO has the signal state "0" if one of the following conditions applies:

  • Enable input EN has the signal state "0".

  • A floating-point number has an invalid value.

Parameters

The following table shows the parameters of the instruction "Form absolute value":

Parameters

Declaration

Data type

Memory area

Description

S7-1200

S7-1500

S7-1200

S7-1500

EN

Input

BOOL

BOOL

I, Q, M, D, L or constant

I, Q, M, D, L, T, C or constant

Enable input

ENO

Output

BOOL

BOOL

I, Q, M, D, L

I, Q, M, D, L

Enable output

IN

Input

SINT, INT, DINT, floating-point numbers

SINT, INT, DINT, LINT, floating-point numbers

I, Q, M, D, L, P or constant

I, Q, M, D, L, P or constant

Input value

OUT

Output

SINT, INT, DINT, floating-point numbers

SINT, INT, DINT, LINT, floating-point numbers

I, Q, M, D, L, P

I, Q, M, D, L, P

Absolute value of the input value

You can select the data type of the instruction from the "???" drop-down list of the instruction box.

For additional information on valid data types, refer to "See also".

Example

The following example shows how the instruction works:

The following table shows how the instruction works using concrete operand values:

Parameters

Operand

Value

IN

TagIn_Value

-6.234

OUT

TagOut_Value

6.234

If the "TagIn" operand has signal state "1", the instruction is executed. The instruction calculates the absolute value of the value at input "TagIn_Value" and sends the result to output "TagOut_Value". If the instruction is executed without errors, the "TagOut" output is set.