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

조회 수: 5 (최근 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