LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI PCI 1588; NISync C API Alternative for .NET Applications?

Hi,
 
I am working on an application that needs to get the time from an NI PCI 1588 card.  I saw the NISync documentation on how to talk to the card via the NISync C API.
Currently, I am using NISync.h and NISync.lib via Managed C++ to talk to the card, but most of my application is .NET.  Is there a better way to talk to the card from a .NET application?
 
Thanks
YeeManB
0 Kudos
Message 1 of 4
(4,004 Views)
Hi YeeManB,
 
There is not a native .NET API to NI-Sync meaning that you will need to use the C API from .NET.  Now, I will say that Measurement Studio includes the Instrument Driver Wizard which will generate C# or VB.NET wrappers around the C API.  While this API isn't nearly as nice as a native .NET API, it does provide you some benefits: you do not have to hand-code the P/Invoke declarations, it manages the session for you (including implementation of IDisposable to help you clean up), and conversion of error code return values to exceptions.  That wizard only generates C# and VB.NET code so I'm not sure if that will work for you considering you mentioned Managed C++ (i.e. not sure if you are using VS .NET 2003 or VS 2005 which now uses the C++/CLI term). 
 
Not sure if that's what you wanted to hear, but I just thought I would mention that.
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 4
(3,997 Views)

Hi Jonathan,

I am in VS 2008.  Let me iterate all the options available today to communicate with the PCI 1588 card from a .NET application.

1) Call the C API from C++/CLI through standard function calls by including niSync.h file and linking with niSync.lib
2) Call the C API through PInvoke to niSync.dll <correct?> from C++/CLI, C#, or whatever .NET language.  Is there a wiki online for the niSync PInvoke signatures like http://www.pinvoke.net/?
3) Use Measurement Studio to generate C# or VB.NET wrappers around the C API, compile and use them with my application

Is the above list complete?  I am not sure #3 is a good solution for me since I am in VS2008. 

Thanks!
YeeManB

0 Kudos
Message 3 of 4
(3,985 Views)
Hi YeeManB,
 
Yeah, that list seems correct to me. With regards to VS 2008, Measurement Studio will be coming out with native support for Visual Studio 2008 soon. In that case, you will have access to the Instrument Driver Wizard. 
 
Unfortunately there is no document or wiki like pinvoke.net (which is really nice; I use that site quite frequently) for niSync.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 4 of 4
(3,983 Views)