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

IN

ANY_BIT

The operand.

Outputs

Name

Type

Description

Return value

ANY_BIT

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

References