The example model "sldrtex_canmessage" shows how to transfer data through CAN bus, utilizing the CAN_MESSAGE data type and the CAN Pack and CAN Unpack blocks available in Vehicle Network Toolbox block library. The CAN_MESSAGE data type can be directly processed by Simulink Desktop Real-Time blocks. The model sends data within one computer, from one CAN channel to another. The two CAN channels can be either virtual channels or physical channels on a dual-channel CAN device. You can modify the model to communicate between two computers by splitting this model into its send and receive parts and running the models on two computers. The yellow blocks are used to send the data, the blue blocks are used to receive the data.
How to run this model in Normal Mode:
Double-click the orange button to switch to Normal Mode if needed.
Start the real-time execution using Simulation->Run.
How to run this model in External Mode:
Double-click the orange button to switch to External Mode if needed.
Start the real-time execution using Simulation->Run. The model will automatically build, connect to Simulink in External Mode and start.
Note: This model runs on Microsoft Windows only.