LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an xnet session to a exe?

I have a CAN project that I am turning into an exe and I am trying to figure out how to add an XNET session.  I found a thread that showed how to do it with XNET frames by pointing to the xml file.  I took a look at the database vi's where I can look at the dbc file that my session points to, but have not found a way to point to a particular session.

 

I figured you would just point to the session while building the exe, but I have not found that option yet.

0 Kudos
Message 1 of 6
(5,539 Views)

Bryan,

 

To build an XNET Session into an executable, you must first put that XNET session into a VI. Then you select the the VI as the top level for the build specification.

 

I take it that you are building new XNET sessions using the wizard inside project explorer. You can then build a new VI and drag and drop the XNET session into the VI. Hope this information is helpful.

 

-Nick-

Nick C | Software Project Manager - LabVIEW Real-Time | National Instruments
0 Kudos
Message 2 of 6
(5,521 Views)

I already had a session and (2) frames working in a VI in the development environment as part of a project.

 

The problem is getting it all to work in a exe on a virgin machine.  All the XNET calls throw error 1074384560.  I was able to fix the error on the session data by going into the database editor and manually adding the alias to the DBC file.  But I need to have this automated for some off site testing.  I think I found an example on how to automate this that I will try.

 

The (2) XNET create session (frame) still have the error.  I have included the files created (xml I think) in the exe, but that has not helped.

0 Kudos
Message 3 of 6
(5,513 Views)

Finally got everything working.  I ended up checking the current alias list and if my alias was not there I add it.  Not very elegant, but that part works fine now.

 

I just figured most of that would have been automated since the project has all the information it needs when building the program.  But that part works now......

0 Kudos
Message 4 of 6
(5,508 Views)

Bryan,

 

Good to hear that you got everything up and running. If the device is installed on your machine and it appears in MAX, it should autopopulate into the control where you can select your XNET device. If this is hard coded it seems possible that this list isn't autopopulating. If you are selecting the alias programmatically from a list of constants on your block diagram, try regenerating the alias list and see if your device is appearing in the list now. 

 

-Nick-

Nick C | Software Project Manager - LabVIEW Real-Time | National Instruments
0 Kudos
Message 5 of 6
(5,499 Views)

The alias did show up in the exe, then I got the errors that I already mentioned.  It did not work until I linked the session to the DBC file using the database editor on the new machine.  On page 4-531 of the XNET manual at the top it says:

 

"If your application accesses a database file using an alias, you must add the alias using XNET Database Add Alias.vi. You can use this VI as part of an installation process or call it within the executable itself."

 

So that is what I ended up doing.  I just figured that it would do that automatically since it was aready done in the project.

 

 

Message 6 of 6
(5,494 Views)