Main Content

transmitEvent

Configure messages for event-based transmission

Description

transmitEvent(canch,msg,state) enables or disables an event-based transmit of the CAN message, msg, on the channel, according to the state argument of 'On' or 'Off'. A typical event that triggers a transmission is a change to the message Data property.

example

Examples

collapse all

Configure a channel with an event-based message.

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

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

Enable the message for event-based transmit, start the channel, and pack the message to trigger the event-based transmit.

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

Input Arguments

collapse all

CAN channel, specified as a CAN channel object. This is the channel by which you access the CAN bus, and the channel on which the specified message is enabled for event-based transmit.

Message to transmit, specified as a CAN message object or array of message objects. This is the message enabled for event-based transmission on the specified CAN channel.

Enable event-based transmission, specified as 'On' or 'Off'.

Example: 'On'

Data Types: char | string

Version History

Introduced in R2010b