UnpackArrayOfByte (FUN)¶
FUNCTION UnpackArrayOfByte : UINT
The function unpacks an “ARRAY OF BYTE” in an “ARRAY OF BOOL”.
The function copies the amount of “uiNumberOfBits” from “abySource” to “axDestination”. The function will return the number of bytes considered in “abySource”. If “pabySource”, “paxDestination” or “uiNumberOfBits” are set to “0”, the copying will not be carried out and the function will return “FALSE”.
Example:
abySource : ARRAY[0..2] OF BYTE := 16#32, 16#01, 16#00 ;
axDestination : ARRAY[0..9] OF BOOL ;
uiNumberofBytes := MEM.UnpackArrayOfByte(ADR(abySource), ADR(axDestination), 10) ;
->
uiNumberofBytes = 2
axDestination[0] = FALSE
axDestination[1] = TRUE
axDestination[2] = FALSE
axDestination[3] = FALSE
axDestination[4] = TRUE
axDestination[5] = TRUE
axDestination[6] = FALSE
axDestination[7] = FALSE
axDestination[8] = TRUE
axDestination[9] = FALSE
Note
The size of the array “axDestination” has to be adjusted to the number of bits to be copied! Source and target may not overlap!
- InOut:
Scope
Name
Type
Comment
Return
UnpackArrayOfByteUINTfunction returns the number of bytes considered in “abySource”
Input
pabySourcePOINTER TO BYTE
address of BYTE ARRAY
paxDestinationPOINTER TO BYTE
address of BOOL ARRAY
uiNumberOfBitsUINTnumber of bits to copy from “abySource” to “axDestination”