canMessage

Build CAN message based on user-specified structure

Syntax

message = canMessage(id, extended, datalength)
message = canMessage(database, messagename)

Description

message = canMessage(id, extended, datalength) creates and returns a CAN message object, from the raw message information.

message = canMessage(database, messagename) constructs a message using the message definition of the specified message, in the specified database.

Input Arguments

id

The ID of the message that you specify.

extended

Indicates whether the message ID is of standard or extended type. The Boolean value is true if extended or false if standard.

datalength

The length of the data of the message, in bytes. Specify from 0 through 8.

database

Handle to the CAN database containing the message definition.

messagename

The name of the message definition in the database.

Output Arguments

message

The message object returned from the function.

Properties

DataSet CAN message data
DatabaseStore CAN database information
ErrorCAN message error frame
ExtendedIdentifier type for CAN message
IDIdentifier for CAN message
Name (Message)CAN message name
RemoteSpecify CAN message remote frame
SignalsDisplay physical signals defined in CAN message
TimestampDisplay message received timestamp
UserDataEnter custom data

Examples

To construct a CAN message, type:

 message = canMessage(2500, true, 4)

To construct a message using CAN database message definitions, create a database object using the canDatabase function, and then construct your message:

candb = canDatabase('c:\database.dbc')
message = canMessage (candb, 'messagename')
Was this topic helpful?