58
9.6.4 CAN_Read
CAN_Read(Handle, Buf)
Function:
Reads a message from the channel with the specified handle.
Parameters:
• Handle
o Type: Integer
o The handle of the CAN channel to read from.
o Format: A numeric value provided by the return value of CAN_Open
o Example: 2508
• Buf
2
o Type: CAN_MSG structure
o The standard structure of CAN frame messages.
o Format: Name of an instance of the CAN_MSG structure
o Example: myCANMsg
• Return value:
o Type: Integer
o Code indicating result of CAN_Read.
o Result:
1, CAN_Read is successful
-1, error communicating with COM port
-4, error: CAN channel is not open
-5, error: there are no messages
Sample Command:
CAN_Read(2508, myCANMsg)
Reads the message from device connected to channel with the handle 2508 and stores
it into myCANMsg.
2
Refer to the “CAN_MSG Structure” section for more information