How to set CAN Bus speed over 500kbps?!?

3 ビュー (過去 30 日間)
Babak
Babak 2019 年 6 月 11 日
Hello guys, I am using 2ports NI CAn interface and configure them as a receiver (Port1) and a transmitter (Port2). and I can communicate between these two ports up to 100,000bps. Any value over that cannot be received by port 1?! Why is that?
Here is my code:
clc
clear all
BusSpeed=200*1e3;
%canHWInfo
rxCh = canChannel('NI','CAN1'); %Create a Receiving Channel
txCh = canChannel('NI','CAN2'); %Create a Transmiting Channel
configBusSpeed(rxCh,BusSpeed)
configBusSpeed(txCh,BusSpeed)
% canMessage %
messageout = canMessage(3333,true,5)
% Pack a Message %
pack(messageout,10,0,16,'LittleEndian')
% Start channels %
start(rxCh)
start(txCh)
% Transmit a Message %
transmitPeriodic(txCh,messageout,'On',1);
%% Receive a Message %
rxMsg = receive(rxCh, Inf, 'OutputFormat', 'timetable')

回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by