IN_RANGE: Value within range (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
IN_RANGE: Value within range

Description

You can use the "Value within range" instruction to query whether of the value at VAL input is within a specific value range.

You specify the limits of the value range with the MIN and MAX inputs. The "Value within range" instruction compares the value at input VAL with the values of the inputs MIN and MAX and sends the result to the box output. If the value at input VAL satisfies the comparison MIN <= VAL or VAL <=MAX, the box output has the signal state "1". If the comparison is not fulfilled, the signal state is "0" at the box output.

The comparison function can only execute if the values to be compared are of the same data type.

Parameters

The following table shows the parameters of the "Value within range" instruction:

Parameters

Declaration

Data type

Memory area

Description

MIN

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

Low limit of the value range

VAL

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

Comparison value

MAX

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

High limit of the value range

Box output

Output

BOOL

I, Q, M, D, L

Result of the comparison

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:

Output "TagOut" is set when the following conditions are fulfilled:

  • The operands "TagIn_1" or "TagIn_2" have signal state "1".

  • The operand "TagIn_3" has the signal state "1".

  • The value of the operand "Tag_Value" is within the value range that is specified by the current values of the operands "Tag_Min" and "Tag_Max" (MIN <= VAL or VAL <= MAX).