Documentation

transmitPeriodic

Configure messages for periodic transmission

Syntax

transmitPeriodic(canch, msg, 'On', period)
transmitPeriodic(canch, msg, 'Off')

Description

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

transmitPeriodic(canch, msg, 'Off') disables periodic transmit of the message, msg, on the channel, canch.

Input Arguments

canch

The name of the CAN channel on which the specified message is enabled for periodic transmit.

msg

The message enabled for periodic transmission on the specified CAN channel.

'state'

Specify whether periodic transmission is enabled on the specified message. Input On for enabling periodic transmission on the specified message and Off to disable it. If you enable periodic transmission, specify a period value.

period

Specify a period in seconds. This value is used to transmit the message in the specified period. By default this value is 0.500 seconds.

Examples

Construct a CAN channel and configure a message on the channel:

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

Enable the message for periodic transmit. Set the period value to 1 sec, start the channel, and update the data in the message you want to send periodically:

transmitPeriodic(canch, msg, 'On', 1);
start(canch);
msg.Data = [1 2 3 4];

More About

expand all

Tips

You can enable and disable periodic transmit even when the channel is running. This functionality allows you to make changes to the state of the channel without stopping the channel.

Was this topic helpful?