SysMemSwap (FUN)

FUNCTION SysMemSwap : DINT

Routine to swap memory into littel endian. If little endian (intel) byteorder is received and platform has big endian (motorola) byteorder. On little endian byteorder platforms, routine does nothing RETURN: Number of bytes swapped:

  • -1 = failed (iSize too large)

  • 0 = no swapping necessary (little endian byteorder)

  • >0 = Number of bytes swapped (big endian byteorder)

InOut:

Scope

Name

Type

Comment

Return

SysMemSwap

DINT

Input

pbyBuffer

POINTER TO BYTE

Pointer to data to swap. You can check, which order is selected by calling the routine with pbyBuffer=0

udiSize

UDINT

Size of one element to swap

udiCount

UDINT

Number of elements to swap