Modifying Read Only ID of CAN message

1 回表示 (過去 30 日間)
Maximilian Koch
Maximilian Koch 2020 年 7 月 16 日
I'm using a network of multiple sensors that I want to configure over CAN. Each Sensor has an ID from 0-7.
I currently use a CAN-database to create the Config-message. The default config message identifier is 0x200. The identifier gets changed based on the sensor I want to configure like this:
message-ID = 0x200 + sensorID*0x10
So the config message for sensor 0 has ID 0x200, sensor 1 0x210, sensor 2 0x220 and so on. The same is true for all other messages that can be sent.
The easiest solution for me would be to modify the message-ID from the default message (ID 0x200) like I'm already doing it with the signals:
msgRadarCfg = canMessage(dbc,'RadarCfg');
msgRadarCfg.Signals.RadarCfg_SensorID = sensorID;
Message.ID however is read-only, so this doesn't work:
msgRadarCfg.ID = msgRadarCfg.ID + sensorID*16;
Is there another way to change the message ID without me either modifying the dbc-file to include all messages for all sensor-IDs or building the messages "by hand"?

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by