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.

FOUNDATION Fieldbus

cancel
Showing results for 
Search instead for 
Did you mean: 

calling NI-FBUS Comunication manager API from Labview

Hi,
I am working with the NI-FBUS PCI card. I am trying to call the nifGetDeviceList function of the Comunication Manager API from Labview but I have no idea how to do it. Have I to build a DLL? How can I do it?
Thank you

Arnaud
0 Kudos
Message 1 of 8
(13,459 Views)
You don't need to build a DLL, just call the "nifb.dll", but please refer to "NI-FBUS Function Reference Manual" for C prototypes.

As to call DLL in LabVIEW, there are quite a lot of resource here (NI Develper Zone), you can simply search "DLL" in LabVIEW topics.

Please keep in mind you have to follow NI-FBUS hierachy of Session>Interface>Device to get to call "nifGetDeviceList".

Hope it helps.
0 Kudos
Message 2 of 8
(13,459 Views)
You can also use the fieldbus LabVIEW toolkit shipped with NI-FBUS 3.0 or above, which can speed up developing fieldbus application in LabVIEW.

You can get the related tutorial in the Online Tutorials (
http://digital.ni.com/softlib.nsf/websearch/AA5FA859BD484D1786256F08001467B0?opendocument)
0 Kudos
Message 3 of 8
(13,459 Views)

Hi

I am trying to do same but with different tool. Its Visual studio C++.

I have got sample code from NI-FBUS installlation files. Using same for compilation. 

Any starting point you would like to share? I am very new to both 1) Using NI-FBUS API and 2) Visual studio

0 Kudos
Message 4 of 8
(9,862 Views)

Hi dopplerdude,

 

The installer has installed manual guides. Please refer to them.

Start Menu->Programs->National Instruments->NI-FBUS->Documentation

0 Kudos
Message 5 of 8
(9,840 Views)

Yeah thats very true. I am using those manuals as reference already.

Okay, let me little elaborate what I am actually want to do..

 

I want to read parameters of different function blocks by name. For that i am aware NI-FBUS provides APIs. I saw list of APIs categorized as per their function namely administrative, core and device description function.

 

Now to develop an application using visual C++, I installed Visual studio 2010 SP1 on my machine (Windows 7)

 

In VC++ I am not very sure which project type to select to create application. So I tried with both 1)win32 Console Application and 2)Win32 Project.

 

I took source "nifbtest.cpp" and header "nifb.h" files' samples from "MS Visual C" subdirectory of NIFBUS installation folder.

As I am runing NI-FBUS' 4.1.1 version, I linked  nifb64.lib to the project.

Quote from the manual-- "Note NI-FBUS software supports 64-bit since version 4.0.1. To build a 64-bit application,
you must link your application with nifb64.lib. nifb64.dll should be automatically installed in your Windows system directory."

 

When I hit DEBUG I get - 1>nifbtest.obj : error LNK2019: unresolved external symbol _nifOpenSession referenced in function _main 

There  are many of them each for every NI-FBUS API used.

Yes Of course NI-FBUS comm manager is running while I DEBUG.

 

I guess thats it!

I am not aware of C# or .NET for that matter. I know C and C++, the reason why I want to develop host app using VC++.

 

Thank you very much for your earlier quick reply.


 Please see attached image for better and quick understanding of the problem.

0 Kudos
Message 6 of 8
(9,814 Views)

Hi dopplerdue,

 

Sorry for replying late.

From the screenshot I see that you are not very familiar with VS.

The following step should be a start for you:

1. create an empty project.

2. open the property page of your project, and edit the a.)Linker ->Input for the nifb.lib (because you are developing 32-bit app),  b.) C/C++ for the header files. Click OK.

3. In the Header Files add existing files from folder C:\Program Files (x86)\National Instruments\NI-FBUS\MS Visual C\includes so that you can debug better.

4. Add one source file nifbtest.c into Source Files.

 

Don't forget to start NI-FBUS Communication Manager.

 

0 Kudos
Message 7 of 8
(9,775 Views)

HI LewisL,

 

Thanks for detailed reply.

Yes, I am very new to VC, in fact this is the first project in which I am using VC.

 

All those errors vanished as soon as I replaced nifb64.lib with nifb.lib. As you rightly said,it is a 32-bit application.

 

Thanks a lot.

 

 

0 Kudos
Message 8 of 8
(9,770 Views)