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
UnpackDWord (FB) ¶ FUNCTION_BLOCK UnpackDWord Function block unpacks “dwValue” and returns the two contained “wLowWord”, “wHighWord”, the 4 contained bytes “byLLByte” .. “byHHByte” and the 32 bits “xBit0” .. “xBit31”. Prefix: “memudw”. Example: dwValue = 16#01020304 = 2#00000001 00000010 00000011 00000100 -> byLowWord = 16#0304 byHighWord = 16#0102 byLLByte = 16#04 byLHByte = 16#03 byHLByte = 16#02 byHHByte = 16#01 xBit2 , xBit8 , xBit9 , xBit17 and xBit24 = TRUE remaining bits = FALSE InOut: Scope Name Type Comment Input dwValue DWORD DWORD to analyse Output wLowWord WORD low word of dwValue wHighWord WORD high word of dwValue byLLByte BYTE byte LL of dwValue byLHByte BYTE byte LH of dwValue byHLByte BYTE byte HL of dwValue byHHByte BYTE byte HH of dwValue xBit0 BOOL Bit 0 of dwValue xBit1 BOOL Bit 1 of dwValue xBit2 BOOL Bit 2 of dwValue xBit3 BOOL Bit 3 of dwValue xBit4 BOOL Bit 4 of dwValue xBit5 BOOL Bit 5 of dwValue xBit6 BOOL Bit 6 of dwValue xBit7 BOOL Bit 7 of dwValue xBit8 BOOL Bit 8 of dwValue xBit9 BOOL Bit 9 of dwValue xBit10 BOOL Bit 10 of dwValue xBit11 BOOL Bit 11 of dwValue xBit12 BOOL Bit 12 of dwValue xBit13 BOOL Bit 13 of dwValue xBit14 BOOL Bit 14 of dwValue xBit15 BOOL Bit 15 of dwValue xBit16 BOOL Bit 16 of dwValue xBit17 BOOL Bit 17 of dwValue xBit18 BOOL Bit 18 of dwValue xBit19 BOOL Bit 19 of dwValue xBit20 BOOL Bit 20 of dwValue xBit21 BOOL Bit 21 of dwValue xBit22 BOOL Bit 22 of dwValue xBit23 BOOL Bit 23 of dwValue xBit24 BOOL Bit 24 of dwValue xBit25 BOOL Bit 25 of dwValue xBit26 BOOL Bit 26 of dwValue xBit27 BOOL Bit 27 of dwValue xBit28 BOOL Bit 28 of dwValue xBit29 BOOL Bit 29 of dwValue xBit30 BOOL Bit 30 of dwValue xBit31 BOOL Bit 31 of dwValue
Reverse Bit, Swap Byte,Word order ¶ ReverseBYTEsInDWORD (Function) ReverseBYTEsInWORD (Function) ReverseBitsInBYTE (Function) ReverseBitsInDWORD (Function) ReverseBitsInWORD (Function) ReverseWORDsInDWORD (Function)
ReverseBYTEsInDWORD (FUN) ¶ FUNCTION ReverseBYTEsInDWORD : DWORD Function returns the DWORD “dwInput” with a reversed byte-order. Example: dwInput = 16#01020304 -> MEM.ReverseWORDsInDWORD ( dwInput ) = 16#04030201 InOut: Scope Name Type Comment Return ReverseBYTEsInDWORD DWORD function returns a DWORD with reversed byte-order of “dwInput” Input dwInput DWORD DWORD to reverse
ReverseBYTEsInWORD (FUN) ¶ FUNCTION ReverseBYTEsInWORD : WORD Function returns the WORD “wInput” with a reversed byte-order (Low-Byte<->High-Byte). Example: wInput = 16#0102 -> MEM.ReverseBYTEsInWORD ( wInput ) = 16#0201 InOut: Scope Name Type Comment Return ReverseBYTEsInWORD WORD Input wInput WORD WORD to reverse
ReverseBitsInBYTE (FUN) ¶ FUNCTION ReverseBitsInBYTE : BYTE Function returns the BYTE “byInput” with a reversed bit-order. Example: byInput = 16#01 = 2#00000001 -> MEM.ReverseBitsInBYTE ( byInput ) = 16#80 = 2#10000000 InOut: Scope Name Type Comment Return ReverseBitsInBYTE BYTE function returns a BYTE with reversed bit-order of “byInput” Input byInput BYTE BYTE to reverse
ReverseBitsInDWORD (FUN) ¶ FUNCTION ReverseBitsInDWORD : DWORD Function returns the DWORD “dwInput” with a reversed bit-order. Example: dwInput = 16#01020304 = 2#00000001 00000010 00000011 00000100 -> MEM.ReverseBitsInDWORD ( dwInput ) = 16#20C04080 = 2#00100000 11000000 01000000 10000000 InOut: Scope Name Type Comment Return ReverseBitsInDWORD DWORD function returns a DWORD with reveresed bit-order of “dwInput” Input dwInput DWORD DWORD to reverse
ReverseBitsInWORD (FUN) ¶ FUNCTION ReverseBitsInWORD : WORD Function returns the WORD “wInput” with a reversed bit-order. Example: wInput = 16#0102 = 2#00000001 00000010 -> MEM.ReverseBitsInWORD ( wInput ) = 16#4080 = 2#01000000 10000000 InOut: Scope Name Type Comment Return ReverseBitsInWORD WORD function returns a WORD with reversed bit-order of “wInput” Input wInput WORD WORD to reverse
ReverseWORDsInDWORD (FUN) ¶ FUNCTION ReverseWORDsInDWORD : DWORD Function returns the DWORD “dwInput” with a reversed word-order (Low-Word<->High-Word). Example: dwInput = 16#01020304 -> MEM.ReverseWORDsInDWORD ( dwInput ) = 16#03040102 InOut: Scope Name Type Comment Return ReverseWORDsInDWORD DWORD function returns a DWORD with reversed word-order of “dwInput” Input dwInput DWORD DWORD to reverse
GetSupplierVersion (FUN) ¶ FUNCTION GetSupplierVersion : WORD Function returns the supplier version of this library. High byte contains the release version. Low byte contains the version of implementation. InOut: Scope Name Type Comment Return GetSupplierVersion WORD function returns the supplier version of this library in form of a WORD Input xDummy BOOL dummy bool, right now having no effect on the version