This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

CAN Input/Output

This example shows how to transfer data through CAN bus. 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. Two different CAN messages using different message identifiers are being transmitted. 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.

Note: This model runs on Microsoft Windows only.

How to run this model in Normal Mode

  1. Double-click the orange button to switch to Normal Mode if needed.

  2. Start the real-time execution using Simulation->Run.

How to run this model in External Mode

  1. Double-click the orange button to switch to External Mode if needed.

  2. Start the real-time execution using Simulation->Run. The model will automatically build, connect to Simulink in External Mode and start.

Open the model, suppressing warning about board not installed

w = warning('off', 'sldrt:blkgui:boardnotonlist');
open_system(fullfile(matlabroot,'toolbox','sldrt','sldrtexamples','sldrtex_canio'));
warning(w);

Close any open Scopes

close_system(find_system(gcs ,'BlockType', 'Scope'));
clear
close all
bdclose all

See Also