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
EXTRACTBOOLThe Nth bit of value
XInput
XDWORDInput value
NBYTENumber of the bit to be extracted. Counting starts at 0.