08-18-2017 12:08 PM
This morning I looked at using XNET to load a CAN bus (J1939) .dbc file where I would parse frames, signals, signal SPNs, and misc signal details. I was successful except I just can't figure out how to extract the SPN for a signal. Seems like I am just a few clicks away but I'm having no luck.
Any one have an idea how this is done?
Thanks,
Todd
08-21-2017 03:41 PM
Hello Labviewman,
Please check this thread.
https://forums.ni.com/t5/LabVIEW/Diagnostic-Messages-J1939/td-p/2157174
Diego H
National Instruments
08-22-2017 12:41 PM
Thanks, but that doesn't help.
08-22-2017 03:12 PM
Unfortunately J1939 with XNET does not currently offer the capability to extract the SPN from the signal information contained in the database.
08-25-2017 10:03 AM
Since it doesn't look like this is possible via the XNET API, I figured out the .dbc database structure for the SPNs (signal names).
The line I look for is structured like this:
BA_ "SPN" SIG_ XXXX SPNname SPNNumber;
I look for '"SPN" SIG_' and parse the rest (XXXX is a cross reference to the PGN/message name). If no error, I add the SPNname and SPNNumber to the 'SPN found' arrays. Then, since I already know the SPNnames for the signals in the database via the XNET Database vis, I search the created array (SPN name found array), take the index to the found name and index the SPNNumber array for the SPN/signal number.
The above method found 97% of the SPN numbers for the SPNnames found with the XNET database vis. I checked about 10 of the 3% that were not found...they didn't have a SPN/signal number, so it seems my method works.