Modifying Read Only ID of CAN message

1 visualización (últimos 30 días)
Maximilian Koch
Maximilian Koch el 16 de Jul. de 2020
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"?

Respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by