This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Send CAN messages to CAN bus





transmit(canch,message) sends the message or array of messages onto the bus via the CAN channel.

For more information on the elements of a message, see canMessage.


The transmit function ignores the Timestamp (CAN) property and the Error property.

CAN is a peer-to-peer network, so when transmitting messages on a physical bus at least one other node must be present to properly acknowledge the message. Without another node, the transmission will fail as an error frame, and the device will continually retry to transmit.


Transmit a CAN Message

Define a CAN message and transmit it to the CAN bus.

message = canMessage (250,false,8);
message.Data = ([45 213 53 1 3 213 123 43]);
canch = canChannel('MathWorks','Virtual 1',1);

Transmit an Array of Messages

Transmit an array of three CAN messages.


Transmit Messages on a Remote Frame

Transmit a CAN message on a remote frame, using the message Remote property.

message = canMessage(250,false,8);
message.Data = ([45 213 53 1 3 213 123 43]);
message.Remote = true;
canch = canChannel('MathWorks','Virtual 1',1);

Input Arguments

collapse all

CAN channel, specified as a CAN channel object. This is the channel by which you access the CAN bus.

Message to transmit, specified as a CAN message object or array of message objects. These messages are transmitted via a CAN channel to the bus.

See Also


Introduced in R2009a