Main Content

transmitPeriodic

Configure messages for periodic transmission

Description

transmitPeriodic(canch,msg,'On',period) enables periodic transmit of the message, msg, on the channel, canch, to transmit at the specified period, period.

You can enable and disable periodic transmit even when the channel is running, allowing you to make changes to the state of the channel without stopping it.

transmitPeriodic(canch,msg,'Off') disables periodic transmission of the message, msg.

example

Examples

collapse all

Configure a channel to transmit messages periodically.

Construct a CAN channel and message.

canch = canChannel('MathWorks','Virtual 1',1);
msg = canMessage(500,false,4);

Enable the message for periodic transmission on the channel, with a period of 1 second. Start the channel, and pack the message you want to send periodically.

transmitPeriodic(canch,msg,'On',1);
start(canch);
pack(msg,int32(1000),0,32,'LittleEndian')

Input Arguments

collapse all

CAN channel, specified as a CAN channel object. This is the CAN channel for which you are controlling periodic transmission.

Message to transmit, specified as a CAN message object. This is the message enabled for periodic transmission on the specified CAN channel.

Period of transmissions, specified in seconds as a numeric value. This argument is optional, with a default of 0.5 seconds.

Example: 1.0

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Version History

Introduced in R2010b