필터 지우기
필터 지우기

Create listener / Interrupt to detect new CAN message

조회 수: 2 (최근 30일)
Gerd
Gerd 2011년 6월 6일
Hi all,
I am writing some routines to interface my PEAK Systems CAN USB Dongle. I managed to get it all working (send and receive) but to have a nice application I would like to know if it is possible to create a listener in Matlab. Background is I have a function Read() which is == 0 when a new message is available. I would like to detect this state in a "background" task to display the new message when the message is available. Cheers Gerd

답변 (2개)

Chirag Gupta
Chirag Gupta 2011년 6월 6일
The CAN interface itself provides for MessageReceivedFcnCount and MessageReceivedFcn properties that can used to execute a call back whenever messages are available
There are multiple ways of creating listeners. One of the methods is if you are using MATLAB Classes and Objects, then you can define events and listeners.
Another way is to just poll in the background using timers.

Gerd
Gerd 2011년 6월 6일
Hi Chirag,
thank you for your answer. The functions you described MessageReceivedFcnCount and MessageReceivedFcn are from the Vehicle Network toolbox. Unfortunally this toolbox doesn't support my Hardware(PeakSystem CAN Dongle). So these functions are not available so far.
I am not using OOP in Matlab so I think I have to find my way using timers. Is there no other possiblility?

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by