COIfSend
Description
This function sends the given CAN frame on the interface without delay.
Prototype
CPU_INT16S COIfSend(CO_IF *cif, CO_IF_FRM *frm);
Parameter | Description |
---|---|
cif | pointer to the interface structure |
frm | pointer to the transmit frame buffer |
Returned Value
>0 the size of CO_IF.FRM
on success
<0 the internal CanBus error code
Example
The send function may be used within the application to transmit additional messages on the CANopen interface. The following example show how to call the transmit function for the interface of the CANopen node AppNode:
CO_IF_FRM frame; CPU_INT16S err; : frame.Identifier = 0x123; frame.DLC = 8; frame.Data[0] = 0x12; frame.Data[1] = 0x23; frame.Data[2] = 0x34; frame.Data[3] = 0x45; frame.Data[4] = 0x56; frame.Data[5] = 0x67; frame.Data[6] = 0x78; frame.Data[7] = 0x89; err = COIfSend (&(AppNode.If), &frame); if (err < 0) { /* error in interface layer */ } :
Note: Be careful with transmitting additional messages on an active CANopen network. This might result in unpredictable behavior of the complete system.