With this function, you can swap the elements of a memory area. The elements are inverted byte-by-byte, i. e., the first element is swapped with the last, the second with the second to last, and so on.
Input |
Data type |
Description |
---|---|---|
i_dwAddress |
DWORD |
Initial address of the memory area |
i_diSize |
DINT |
Not used |
i_diCount |
DINT |
Number of bytes to be swapped |
xResult : BOOL;
abyData : ARRAY[1..10] OF BYTE;
pbyAddresse : POINTER TO BYTE;
pbyAddresse := ADR(abyData);
xResult := FC_MemorySwap(pbyAddresse,0,SIZEOF(abyData));
If the array contained the elements [0,1,2,3,4,5,6,7,8,9] before calling up the FC_MemorySwap(), then the array has the following contents after the function call-up: [9,8,7,6.5,4,3,2,1,0].