From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read message of Can bus in LabVIEW

Hi guys. I have a question here on how can i read the message of CAN bus in LabVIEW?

I am using DAQ usb-6251 together with the CAN modules NI usb-8473 (high speed) and NI-usb 8472 (low speed).

0 Kudos
Message 1 of 11
(17,902 Views)

What error do you recieve?

 

CAN frames recieved need to be translated into signals based on database files.

You can use NI-mAX Bus monitor to read the frames that are being received. If there are no database files, you must decode the CAN frames.

 

 

 

Regards,

 

0 Kudos
Message 2 of 11
(17,895 Views)

I don't know what error you are seeing but the source looks like it should work.  Have you confirmed it is working using the bus monitor in MAX?  If it doesn't work there, then there is something wrong with your setup.  Also there is an example under Help >> Example Finder for reading and writing frames on the same port and that should also work.

0 Kudos
Message 3 of 11
(17,884 Views)

Basically i'm so new to all this bus system. also how do i decode the the CAN frames? 

What should i do first in order to get the messages from the raw data?

0 Kudos
Message 4 of 11
(17,782 Views)

You will need either the DBC or some sort of documentation that shows the format of each message.  The messages and formats for each message will vary by network.

0 Kudos
Message 5 of 11
(17,773 Views)

Did you look at any of the examples I mentioned earlier?  It demonstrates how to do basic frame and signal I/O.

0 Kudos
Message 6 of 11
(17,770 Views)

i try to find the appropriate example but i dont know which one is the most relevant to my case? any suggestion?

 

Thanks in advance

0 Kudos
Message 7 of 11
(17,737 Views)

I'd start with MAX.  If you open MAX and right click your CAN device you should be able to open a bus montitor.  This allows you to quickly read and write frames and log them to disk.  If this doesn't work then there is no hope for your code.

 

For simple frame read write stuff check out the example named "Transmit Receive same Port.vi".

0 Kudos
Message 8 of 11
(17,723 Views)

Hi there,

 

I have the same problem about reading CAN messages.

 

My project consists of 2 CAN interfaces, CAN1 (NI XNET) and CAN0 (High Speed CAN 8473)

 

I'm using the Frame output Signal single point and I can already see the CAN messages and their cyclic timing in the BUS monitor by using CAN0.

 

Question:

 

Is there a way to programatically read and log the CAN messages from CAN0 into a Labview GUI just like how it behaves in the BUS monitor?

0 Kudos
Message 9 of 11
(16,740 Views)

Hi  Nino58

 

I apologize if I misunderstood your question. I found a "Channel Monitor.vi" example in the LabVIEW example finder, which seems to be similar to the bus monitor. Would this VI work for what you intend to do?

 

WenR

0 Kudos
Message 10 of 11
(16,703 Views)