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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading a DBC file XNET

Solved!
Go to solution

Hi!

I am a newbie in LV programming.

I am trying to create a LV program that makes a communication with a CAN interface. 

I have to load a DBC file and I do not want to always put it manually everytime I change it in the home directory of the program. 

I made my program search for the .dbc extention and extract its full path: ex: C:\Data\Users\name\Documents\Labview\DBCFile.dbc.

Now, what I want to do is to open this file via XNET Database and have it as a Cluster, an easy thing to do if you select it manually everytime. 

Is it possible?

I am sorry for my bad english.  

0 Kudos
Message 1 of 3
(4,154 Views)
Solution
Accepted by topic author darkieboy

I found the solution. I have used an XNET ADD ALIAS. 

Used the alias database with which the found .dbc file path is linked to.

What I was doing wrong was to use different aliases for each .dbc, which I had to manually select each time. 

Here is a ss. 

And the sub vi.

I mention that the path of the .dbc is automatically detected. So as a user I only drop the .dbc file along with all of the other files intro a folder and voila. 

P.S. Almost forgot the most important thing...You have to close the database after each use. Outside my sub vi is an XNET CLOSE DATABASE vi that has as input the Refnum Out data. 

Download All
0 Kudos
Message 2 of 3
(4,100 Views)

Sorry for replying to an old post, but just in case anyone else is trying to use this VI to load different database files during runtime and is encountering error -1074384637 (like I was), this snippet I adpated from darkiebov's solution should correct for this.

 

DBC generic.png

 

João Machado, CLD
Message 3 of 3
(2,277 Views)