Basic instructions
8.9 Word logic operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
327
INV (Create ones complement)
Table 8- 169 INV instruction
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 8- 170 Data types for the parameters
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord
DECO (Decode) and ENCO (Encode) instructions
Table 8- 171 ENCO and DECO instruction
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 parame-
ter IN is either 0000 0001 or 0000 0000, then a value of 0 is re-
turned to parameter OUT. If the parameter IN value is 0000 0000,
then ENO is set to FALSE.
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.
Note: The default data type for the DECO instruction is DWORD.
In SCL, change the instruction name to DECO_BYTE or
DECO_WORD to decode a byte or word value, and assign to a
byte or word tag or address.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.