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

10 Ansichten (letzte 30 Tage)
Babak
Babak am 11 Jun. 2019
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')

Antworten (0)

Kategorien

Mehr zu Vehicle Network Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by