Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to parse the .dbc file

Hi,

 

How to parse the DBC CAN file and extract Tx and Rx messages  with Signal Names with respect to the particular Node and output it

to a file and ignoring all the other lines. We are not using NI-CAN. Please suggest me the solution.

 

Thanks in advance ,

 

saikumar

 

 

0 Kudos
Message 1 of 7
(31,407 Views)

Hello Saikumar,

 

The DBC file format is a proprietary file format, so I'm not sure how to extract this information.   You can open a DBC file with a text editor and find your node's name and possibly find how to extract the messages that are associated with it.

 

You could also use the NI-XNET API to parse the file for you.  NI-XNET is a free driver for NI-XNET hardware, but it can also be used to parse DBC and Fibex files.  You can use the C, CVI or LabVIEW API.  Here is an example of what you want to do in LabVIEW:

 

 

 

GetTxRx.PNG

 

Let me know if that helps.

O. Proulx
National Instruments
www.ni.com/support
Message 2 of 7
(31,349 Views)

Saikumar:  You can download the Vector CANoe demo and then use the dbc++ editor to extract Tx or Rx information you want.  Here is a link to the site.  You will need to add some information but the download is free.  http://www.vector.com/vi_downloadcenter_en,,223.html?markierung=CANoe%257Cdemo

I have pasted an image to show you what to select:

I hope this helps.

 

vector canoe download page.png

GCentral
0 Kudos
Message 3 of 7
(31,336 Views)

O. Proulx,

 

I'm looking to parse a DBC file, like you've illustrated.  However, I'm not finding the XNET Database Open.vi in Labview 2015.  Could you update the implementation for changes made in the XNET library since this original post?

 

Thank you,

M. Zolot

0 Kudos
Message 4 of 7
(21,378 Views)

Nothing significant has changed in XNET since this post, well in regards to opening a database.  I'm in 2015 and when I open the attached VI it opens without error.  I think the VI you are having a hard time finding is the Database Add Alias VI which is under the Database >> File Management subpalette.

0 Kudos
Message 5 of 7
(21,374 Views)

first, drop an xnet database constant from the xnet->database mgmt function pallet on the block diagram. from the drop down menu, browse for your dbc file. once it is loaded into memory, select it.

next, use database property node to get clusters. then use cluster property node to extract information like PDU (aka ecu), frames, signals, etc. you can then use pdu property node to get pdu properties like tx/rx frames, or just use frames from the whole cluster.

as far as outputting to a file, it depends on the format you want. you dont have the capability to save this as a new, smaller DBC file unless you use vector DBC editor. you can typecast the xnet values into strings and save a text file, but if your intention is to just parse one pdu out of the database and save as a smaller DBC, you will have to use Vector software.

Dan Haugen
Certified LabVIEW Developer
CLD Instructor
0 Kudos
Message 6 of 7
(10,879 Views)

My own experience:

Open the dbc file with a text editor(WordPad,NotePad e.g),then you will kown its structure and some key words,such as BU_,BO_,SG_ ,CM and so on.You can parse it by regular expression.

 

Message 7 of 7
(8,014 Views)