UnpackWord (FB)¶
FUNCTION_BLOCK UnpackWord
Function block unpacks “wValue” and returns the 2 bytes contained “byLowByte” and “byHighByte” and the 16 bits “xBit0” .. “xBit15”.
Prefix: “memuw”.
Example:
wValue = 16#0102 = 2#00000001 00000010
->
byLowByte = 16#02
byHighByte = 16#01
xBit1, xBit8 = TRUE
remain bits = FALSE
- InOut:
Scope
Name
Type
Comment
Input
wValue
WORD
WORD to analyse
Output
byLowByte
BYTE
low byte of wValue
byHighByte
BYTE
high byte of wValue
xBit0
BOOL
Bit 0 of wValue
xBit1
BOOL
Bit 1 of wValue
xBit2
BOOL
Bit 2 of wValue
xBit3
BOOL
Bit 3 of wValue
xBit4
BOOL
Bit 4 of wValue
xBit5
BOOL
Bit 5 of wValue
xBit6
BOOL
Bit 6 of wValue
xBit7
BOOL
Bit 7 of wValue
xBit8
BOOL
Bit 8 of wValue
xBit9
BOOL
Bit 9 of wValue
xBit10
BOOL
Bit 10 of wValue
xBit11
BOOL
Bit 11 of wValue
xBit12
BOOL
Bit 12 of wValue
xBit13
BOOL
Bit 13 of wValue
xBit14
BOOL
Bit 14 of wValue
xBit15
BOOL
Bit 15 of wValue