GetMessageDataPointer (FUN)¶
FUNCTION GetMessageDataPointer : POINTER TO CL2I.DATA
Returns pointer to the eight data bytes of a message. Number of valid bytes can be retrieved by GetMessageLength.
Note
The data is organised in the “Network Byte Order“ of the CANbus. The alignment of data types in the RTS memory may differ from the alignment in the data messages.
Example
VAR
hMsg : CAA.HANDLE;
pData : POINTER TO CL2I.DATA;
usiMsgLen : USINT;
byFirstByte : BYTE;
bySecondByte : BYTE;
eError : CL2.ERROR;
END_VAR
IF hMsg <> CAA.gc_hINVALID THEN
//Get message data pointer
pData := CL2.GetMessageDataPointer(hMessage := hMsg, peError := ADR(eError));
usiMsgLen := CL2.GetMessageLength(hMessage := hMsg, peError := ADR(eError)); //get number of valid bytes
IF pData <> CAA.gc_pNULL THEN
byFirstByte := pData^[0];
bySecondByte := pData^[1];
END_IF
END_IF
- InOut:
Scope
Name
Type
Comment
Return
GetMessageDataPointer
POINTER TO CL2I.DATA
Pointer to message data
Input
hMessage
CAA.HANDLE
handle of message
peError
POINTER TO ERROR
optional pointer to error enum