BCDCPL: Create tens complement (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
BCDCPL: Create tens complement

Description

You can use the "Create tens complement" instruction to create the tens complement of a seven-digit BCD number specified in the IN parameter. This instruction uses the following mathematical formula to calculate:

10000000 (as BCD)

– 7-digit BCD value

----------------------------------------

Tens complement (as BCD)

Parameters

The following table shows the parameters of the "Create tens complement" instruction:

Parameter

Declaration

Data type

Memory area

Description

EN

Input

BOOL

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

Enable input

ENO

Output

BOOL

I, Q, M, D, L

Enable output

IN

Input

Bit strings

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

7-digit BCD number

ERR_CODE

Output

DWORD

I, Q, M, D, L, P

Result of the instruction

Example

The following example shows how the instruction works:

The following table shows how the instruction functions using specific values:

Parameter

Operand

Value*

IN

Tag_Input

DW#16#01234567

ERR_CODE

Tag_Output

DW#16#08765433

*The error codes can be displayed as integer or hexadecimal value in the program editor. You can find information on switching the display formats under "See also".