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

2 次查看(过去 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 CenterFile Exchange 中查找有关 Vehicle Network Toolbox 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by