100BBasic instructions
7.9 Word logic operations
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
227
7.9.2
Invert instruction
Table 7- 127 INV instruction
LAD / FBD
SCL
Description
Not available
Calculates the binary one's complement of the parameter IN. The one's
complement is formed by inverting each bit value of the IN parameter
(changing each 0 to 1 and each 1 to 0). ENO is always TRUE following
the execution of this instruction.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 7- 128 Data types for the parameters
Parameter
Data type
Description
IN
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord
Data element to invert
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord
Inverted output
7.9.3
Encode and decode instructions
Table 7- 129 ENCO and DECO instruction
LAD / FBD
SCL
Description
out := ENCO(IN :=
<expression>);
Encodes a bit pattern to a binary number
The ENCO instruction converts parameter IN to the binary number
corresponding to the bit position of the least-significant set bit of
parameter IN and returns the result to parameter OUT. If
parameter IN is either 0000 0001 or 0000 0000, then a value of 0
is returned to parameter OUT. If the parameter IN value is 0000
0000, then ENO is set to FALSE.
out := DECO(IN :=
<expression>);
Decodes a binary number to a bit pattern
The DECO instruction decodes a binary number from parameter
IN, by setting the corresponding bit position in parameter OUT to
a 1 (all other bits are set to 0). ENO is always TRUE following
execution of the DECO instruction.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 7- 130 Data types for the parameters
Parameter
Data type
Description
IN
ENCO: Byte, Word, DWord
DECO: UInt
ENCO: Bit pattern to encode
DECO: Value to decode
OUT
ENCO: Int
DECO: Byte, Word, DWord
ENCO: Encoded value
DECO: Decoded bit pattern