canFDMessage
Description
creates a CAN FD message object from the raw message information.message
= canFDMessage(id
,extended
,datalength
)
creates a message using the message definition in the specified database. Because
message
= canFDMessage(candb
,messagename
)ProtocolMode
is defined in the message database, you cannot specify
it as an argument to canFDMessage
when using a database.
Examples
Create a CAN FD Message with Database Definitions
Create a CAN FD message using the definitions of a CAN database.
candb = canDatabase("C:\myVNTData\CANFDExample.dbc"); message3 = canFDMessage(candb,"CANFDMessage")
message3 = Message with properties: Message Identification ProtocolMode: 'CAN FD' ID: 1 Extended: 0 Name: 'CANFDMessage' Data Details Timestamp: 0 Data: [1x48 uint8] Signals: [] Length: 48 DLC: 14 Protocol Flags BRS: 1 ESI: 0 Error: 0 Other Information Database: [1×1 can.Database] UserData: []
Create a CAN FD Message
Create a CAN FD message with a standard ID format.
message2 = canFDMessage(1000,false,64)
message2 = Message with properties: Message Identification ProtocolMode: 'CAN FD' ID: 1000 Extended: 0 Name: '' Data Details Timestamp: 0 Data: [1×64 uint8] Signals: [] Length: 64 DLC: 15 Protocol Flags BRS: 0 ESI: 0 Error: 0 Other Information Database: [] UserData: []
Input Arguments
id
— ID of message
numeric value
ID of the message, specified as a numeric value. If this ID used an extended
format, set the extended
argument true
.
Example: 2500
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
extended
— Specify if message ID is extended
true
| false
Specifies whether the message ID is of standard or extended type, specified as
true
or false
. The logical value
true
indicates that the ID is of extended type (29 bits),
false
indicates standard type (11 bits).
Example: true
Data Types: logical
datalength
— Length of message data
integer value 0 to 64
The length of the message data, specified as an integer value of
0
through 64
, inclusive.
Example: 64
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
candb
— CAN database
CAN database object
CAN database, specified as a database object. The database contains the message definition.
Example: candb = canDatabase('CANDatabase.dbc')
messagename
— Name of message
char vector | string
The name of the message definition in the database, specified as a character vector or string.
Example: 'VehicleDataMulti'
Data Types: char
| string
Output Arguments
message
— CAN FD message
CAN message object
CAN FD message, returned as a CAN message object, with the following properties:
Property | Purpose |
---|---|
BRS | CAN FD bit rate switch, as true or false |
Data | Data of CAN message or J1939 parameter group |
Database | CAN database information |
DLC | Data length code value |
Error | CAN message error frame, as true or false |
ESI | CAN FD error state indicator, as true or false |
Extended | True of false indication of extended CAN Identifier type |
ID | Identifier for CAN message |
Length | Message length in bytes |
Name | CAN message name |
ProtocolMode | Protocol mode defined as CAN or CAN FD |
Remote | Specify if CAN message is remote frame |
Signals | Physical signals defined in CAN message or J1939 parameter group |
Timestamp | Message received timestamp |
UserData | Custom data |
Version History
Introduced in R2018b
See Also
Functions
attachDatabase
|canDatabase
|extractAll
|extractRecent
|extractTime
|pack
|unpack
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)