Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

*.fp, *.h and *.lib - which, what, when and why?

Dear All,

I am trying to interface a LeCroy waverunner LT322 with my PC using CVI 5.5. The installation includes several sample applications and driver files, but I can see no rhyme or reason by which files are associated with their project.

One example is lcltxxxx_app.prj, which includes it's own source, header and UIR file and lcltxxxx.fp. However, I notice that if I try to use the instrument function library (lcltxxxx.fp) to initialize the scope it wants to return an instrument handle of type "ViSession", but the sample application just uses a handle of type "int". Moreover, if I try to compile my own project including lcltxxxx.fp and lcltxxxx.h or lcltxxxx_app.h, it fails - it seems it doesn't recognize the datatypes like ViSession or ViReal64.

Then there is lcltxxxx_example.c, which doesn't have an associated UIR file but states in its inital comments that all it needs to run is ONE of the following: lcltxxxx.fp, lcltxxxx.h or lcltxxxx.lib. However, I can only run it successfully if I include ltxxxx.lib, the other files appear to be optional extra (well, lcltxxxx.h is included at the top of lcltxxxx_exmple.c, but I don't need to add it to my CVI project).

In my own program I have begun but just calling the initialization command "lcltxxxx_init", returning a handle of type "ViSession". Once again it seems that all I need to include is the lcltxxxx.lib file for the project to compile, even though I had to load the lcltxxxx.fp file in order to use the interactive cuntion panel to call "lcltxxxx_init".

Finally, if I click on one of the dataypes such as "ViReal64" and select "Go to Definition" with the right mouse button, I open a file called visatype.h, which it seems it the result of about five recursions of "#include somefile.h" starting from '#include lcltxxxx.h".

Can someone please explain to me what all these different files types contain and if, when and what I need to include in my source files or projects to use this IVI driver business?

P.S. I should say that I have already searched the online User Manual that came with my installation, and the NI site for FAQ, application notes, etc., and have found them both to be singularly unhelpful.
0 Kudos
Message 1 of 3
(3,610 Views)
As you already have said, .fp file is the 'instrument file' you must load to use function panels. It must be loaded in the 'Instrument' menu, and maybe is automatically loaded by lcltxxxx_app.prj: go and see. (I don't think this project lists it in the 'library' menu, which is useful for libraries and instruments used by several projects you are developing...)
The .h files contain type and function definitions used both by .fp and .lib file.
They need not to be listed in your project window: it's useful to do so for files you must open frequently since they can be accessed rapidly. Whether you have listed them in the project window or not, you MUST #include them in your source code, otherwise you will get a lot of errors like 'type not defined' or so...
.h
files can include other .h files if necessary and useful, so that you can at the end reach the visatype.h, that lists 'Fundamental VISA data types and macro definitions' as said at its beginning.
And if you look carefully in visatye.h, you will find that viSession remaps to an unsigned long variable: the int used in the example maybe comes from an old version that doesn't use VISA, but I recommend you to use viSession types in order to maintain consistency with the VISA environment.
.lib files are collections of functions to be used and linked in your program: your instrument's documentation should tell you if they are necessary to communicate or if there are alternatives to them (.obj or .llb files...).
Finally I suggest you to look into .fp file (Instrument menu >> edit: select the instrument you want and click 'Attach and edit source'). In the source code you will find how LeCroy interfaces its instruments: in some cases I found I was able to reduce original code to a few functions
and discard a lot of what is included in the instrument driver.
Hope this helps...


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,610 Views)
I am not sure if I got all details from your question but I am assuming you are using the visa library. If this is correct then you will need to include the visa.h file in the file where your ''vi..' functions are being called. Also I don't believe you need to include the lib. function since in cvi you can select the menu option 'load library' to load the visa library. hope this helps.
0 Kudos
Message 3 of 3
(3,610 Views)