LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert message of CAN bus to Engineering Unit

I think at least 2 of the methods I mentioned works on real-time.  You could probably save yourself a lot of work by having the conversion done by a library already written, like the Xnet conversion, or the Frame Channel Conversion library.

 

For me the database file changes often.  It seems every week there is a new database where signals are moved around, or scaling is changed, and to support that all I need to do is change the database file.

0 Kudos
Message 11 of 18
(2,008 Views)

Hi Hooovahh,

 

- XNET does NOT support my 9853 modules, they require FPGA programming.

- Frame2Channel does require additional software installation for the cRIO, which I also try to minimize. (I'm using the older cRIOs with just 64MB RAM, so every software package installled counts…)

So pulling a signal from a frame looks like this:

check.png

I pre-parse the CAN database on the PC, the cRIO only gets a list of signals it has to listen to. J1939 is rather static… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 18
(2,004 Views)

Please don't think I'm criticizing you, your solution sounds like it works for you.

 

I wasn't suggesting XNet supported your CAN device, I was suggesting the XNet library is supported on many cRIO real-time targets, and the conversion could be done there, after frames are read from the FPGA and sent back to the RT side.  Remember you don't need XNet hardware to use the XNet library.  Frames could also be converted at the host side using the XNet library, but I assume you may want to log signals on the RT side and for that the conversion would need to take place on the RT side.

 

EDIT:  Oh and does your Endian-ness never change?  I also have seen that, but of course you could add that functionality to your own conversion if it ever does.

0 Kudos
Message 13 of 18
(1,995 Views)

Hi Hoovahh,

 

endianness is handled in the FPGA (much more efficiently)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 18
(1,990 Views)

I'm sure your conversion routine is better, but I just discovered today that the Automotive Diagnostic Toolkit has some VIs that help with converting from an array of bytes to Engineering Units and back.

 

They are used in an example and aren't part of the library which requires a license to run.  So making your own conversion doesn't seem all that difficult given you have tools to parse the DBC, like the ones provided in the NI-CAN or NI-XNet drivers.

0 Kudos
Message 15 of 18
(1,963 Views)

Hi thanks for your reply. but in here i dont have the Xnet hardware. how do i use the xnet on my project without having its hardware? is it possible?

0 Kudos
Message 16 of 18
(1,854 Views)

I'm an advocate of using NI-XNET for converting between CAN frames and engineering values. We load multiple database files (.dbc and symbol files) into an "in-memory" XNET database and then use that with conversion sessions for converting between the two.

 

GerdW - we actually use NI 9853's as well. Yes you must read the messages on the FPGA but what we do is use a FIFO to send the messages to the RT/Windows host and then use XNET to convert to engineering values and vice-versa. We do pick apart some CAN messages (but only a handful) on the FPGA and convert them (e.g. for safety monitoring) but the bulk of the messages get sent up to Windows so we can handle the CAN data dynamically (e.g. if the database changes or to make the CAN data separate to the application).

 

We started off having a few different implementations of CAN parsing libraries that we had written ourselves and we found that we were running into a lot of issues, including with performance when we tried to do it ourselves and XNET automatically handles things like endianness etc. 

 

As to the original poster: No, you don't need any XNET hardware to use the XNET library for converting between CAN frames and signals. Once you have the database setup you can create receive/transmit conversion sessions and convert between DBL numeric data and CAN frames.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 17 of 18
(1,832 Views)

Hello Clark,

 

You can download the XNET API from:

http://www.ni.com/download/ni-xnet-14.1/4947/en/

This will add the XNET palette to LabVIEW.

 

Regards,

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 18 of 18
(1,817 Views)