Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

transmit

Send CAN messages to CAN bus

Syntax

transmit(canch,message)

Description

example

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.

Note

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.

Examples

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);
start(canch)
transmit(canch,message)

Transmit an Array of Messages

Transmit an array of three CAN messages.

transmit(canch,[message0,message1,message2])

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);
start(canch)
transmit(canch,message)

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 transmited via a CAN channel to the bus.

See Also

Functions

Introduced in R2009a

Was this topic helpful?