How can I use the Vehicle Network Toolbox to transmit CAN messages asynchronously

2 ビュー (過去 30 日間)
Allen Brock
Allen Brock 2024 年 2 月 19 日
回答済み: Ninad 2024 年 2 月 27 日
I need to transmit CAN messages neither periodicly nor on data change, which are the only two options in the CAN Transmit block. Putting the CAN Transmit block within a triggered subsystem doesn't seem to prevent the transmit if periodic is selected once it triggers the first time. Is there a way to indicate to trigger a CAN Message transmit asynchronously based on some logic within my model?
As a quick example of a use case, the heartbeat protocol from CANOpen would have a single message on a device's logical 'boot' with data 0x00. After that, the device moves to pre-op and a periodic message is sent with data 0x7F at some defined rate. If a NMT start is received, the data changes to 0x05 for operational. If a NMT stop is received, the message stops transmitting completely.

回答 (1 件)

Ninad
Ninad 2024 年 2 月 27 日
Hi Allen,
You can use Event-Based CAN Message Transmission Behavior in Simulink. This feature allows for CAN and CAN FD message transmission when a change in data from one time step to the next is detected. Here is the reference link:
You will also have to Implement a custom logic or state machine to manage CAN message transmission in your model.
Regards,
Ninad

カテゴリ

Help Center および File ExchangeVehicle Network Toolbox についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by