NOT¶
Returns the bitwise complement of its input.
Signature¶
┌─────────┐
IN ─┤ NOT ├─ OUT
└─────────┘
FUNCTION NOT : ANY_BIT
VAR_INPUT
IN : ANY_BIT;
END_VAR
END_FUNCTION
The return type matches the input type. NOT accepts BOOL, BYTE,
WORD, DWORD, LWORD.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The operand. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
Every bit of IN inverted. Same type as IN. |
Description¶
On a BOOL input, returns TRUE when the input is FALSE and
FALSE when it is TRUE. On BYTE, WORD, DWORD and LWORD
inputs, every bit of the result is the inverse of the same bit of the input.
NOT(IN := a) is the functional form of the NOT operator: NOT a.
Both forms are equivalent, and NOT(a) is read as the operator applied to
(a).
Example¶
result := NOT(IN := WORD#16#F0F0); (* result = 16#0F0F *)
result := NOT WORD#16#F0F0; (* operator form *)
See Also¶
AND — bitwise AND
OR — bitwise OR
XOR — bitwise exclusive OR
Logical Operators — the operator forms
References¶
IEC 61131-3 §2.5.1.5.3