EXTRACT (FUN)¶
FUNCTION EXTRACT : BOOL
Returns bit number N
of value X
Example in ST:
FLAG := EXTRACT(X:=81, N:=4); (* Result : TRUE, because 81 is binary 1010001, so the bit '4' is 1 *)
FLAG := EXTRACT(X:=33, N:=0); (* Result : TRUE, because 33 is binary 100001, so the bit '0' is 1 *)
- InOut:
Scope
Name
Type
Comment
Return
EXTRACT
BOOL
The Nth bit of value
X
Input
X
DWORD
Input value
N
BYTE
Number of the bit to be extracted. Counting starts at 0.