This function checks pointers to ensure they are within the user programming area of memory. There should be no reason for the user to need to use this function.
Inputs:
ptToTest: POINTER TO BYTE; Destination address of the pointer.
iSize: DINT; Size of the type the pointer points to. (e.g: 20 for POINTER TO ARRAY [0..9] OF INT)
iGran: DINT; Granularity of the pointer access. This is the size of the biggest non-structured data type in the type the pointer points to. (e.g: 2 for POINTER TO ARRAY [0..9] OF INT)
bWrite: BOOL; Indicates read or write Access. TRUE = write access, FALSE = read access.
Return value: POINTER TO BYTE
Example in FBD:
Example in ST:
VarPOINTER_TO_BYTE1 := CheckPointer(VarPOINTER_TO_BYTE2, VarDINT1, VarDINT2, VarBOOL1);