FRAC: Return fraction (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
FRAC: Return fraction

Description

You can use the "Return fraction" instruction to determine the decimal places of the value at the IN input. The result of the query is stored at output OUT and can be queried there. If the input IN has e.g. the value 1.125, the output OUT has the value 0.125.

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

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

  • Errors occur during the execution of the instruction, for example there is no valid floating-point number at the input.

Parameters

The following table shows the parameters of the "Return fraction" instruction:

Parameters

Declaration

Data type

Memory area

Description

S7-1200

S7-1500

EN

Input

BOOL

I, Q, M, D, L or constant

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

Enable input

ENO

Output

BOOL

I, Q, M, D, L

I, Q, M, D, L

Enable output

IN

Input

Floating-point numbers

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

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

Input value, whose decimal places are to be determined.

OUT

Output

Floating-point numbers

I, Q, M, D, L, P

I, Q, M, D, L, P

Decimal places of the input value at input IN

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

You can find additional information on valid data types under "See also".

Example

The following example shows how the instruction works:

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

Parameters

Operand

Value

IN

Tag_Value

1.125

OUT

Tag_Result

0.125

If the operands "TagIn_1" and "TagIn_2" have signal state "1", the instruction is started. The decimal places from the value of operand "Tag_Value" are copied to operand "Tag_Result". If the instruction is executed without errors, the enable output ENO has the signal state "1" and the "TagOut" output is set.