How can I use the Vehicle Network Toolbox to transmit CAN messages asynchronously
5 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vehicle Network Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!