CL2.Write (FUN)

 

This function of the CAA_CanL2.library writes a CAN message via a CAN interface specified by hDriver.

If the message cannot be sent right away, the driver either buffers the message or it returns the error code  "CL2.SENDING_ERROR“ and the sending process must be repeated.

Messages with the same priority are sent in chronological order. Messages with higher priority are always sent prior to those with lower priority. Priority 0 has a special meaning: messages with priority 0 are not queued but sent as soon as possible prior to all other messages waiting for transport. If a priority level not valid for the driver is declared the message is not sent but returned with an error code.

If the “CANopen SYNC” service is enabled with CL2.EnableSyncServic the parameter “xEnableSyncWindows” can be used to guarantee that the messages can only be sent within the current SYNC window. If the applied “coblD” is registered for reception, a message which was sent successfully can be received via CL2.READ with a current time stamp. The application of the function CL2.IsTransmitMessage on such messages returns TRUE.

Input:

hDriver

CAA.HANDLE

handle of CAN interface

hMessage

CAA.HANDLE

handle of CAN message to be written

usiPriority

USINT

sending priority of message with values from 1 (highest priority) to 9. Can be retrieved with GetProperty.

usiPrioity = 0 forces immediate sending!

xEnableSyncWindow*

BOOL

TRUE: sending only inside of current Sync window

Output:

Output:

eError

CL2.ERROR

error code (enumeration type)