LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming PCI-1588 via C#

Sorry I'm not sure if this is in the right place or not but here it goes.  I have 2 PCI-1588 cards from NI and have programmed them all and well through C++ however their implementation into a current system requires the code to be written in C#.  Do the commands listed in the NI-Sync API Reference Help work within C#?

Thanks in advance
0 Kudos
Message 1 of 9
(5,240 Views)

I think you should open VS include NI plug-in and then check your functions..

 

0 Kudos
Message 2 of 9
(5,220 Views)
First step,

How do I include the proper header files/libraries in C#?
0 Kudos
Message 3 of 9
(5,157 Views)
Hello HNelson,
In response to your last question, you want to call the same NI-Sync dll that you referenced when writing your C++ code. This will allow you to write your code within your C# environment in much the same way that you did in your last application.Unfortunately NI-Sync does not have support for .NET languages (i.e. c#) and therefore you must call the C API if you plan on using C# to create your application. If you are having trouble figuring out the proper format for doing this call within C# you can look at the example located here. Thanks again and have a great day!
Regards,

Nicholas K
National Instruments
Applications Engineer
0 Kudos
Message 4 of 9
(5,112 Views)
Hi HNelson,
 
If you had Measurement Studio, you could use the Instrument Driver Wizard to create a .NET wrapper for NI-Sync.  The Instrument Driver Wizard generates a .NET wrapper class based upon the instrument driver function panel, header file and optional .sub files installed for that driver. In this case, when you install CVI support for NI-Sync, you will get the niSync.fp file which is located in the C:\Program Files\IVI Foundation\VISA\WinNT\niSync\ directory.  The wizard creates all the P/Invoke signautres for you whihc is really nice.
 
Anyway, just thought I would throw that out there.
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 5 of 9
(5,098 Views)
Where can I install the CVI support for NI-Sync?  I do not have the CVI examples on this computer and forgot how to install them.  I do have measurement studio and will be trying Janathon's method as soon as I can get my hands on the nisync.fp file. 
0 Kudos
Message 6 of 9
(5,093 Views)
I was able to find nisync.fp on the older computer and was able to begin coding is C#.  Wrote in a simple program to initialize the card and get time however I received the error regarding nisync_32.dll.  I am unable to find it on the computer and am usure of where to get it.
0 Kudos
Message 7 of 9
(5,084 Views)

To install CVI support, you just need to select the LabWindows/CVI Support item in the installer tree for the NI-Sync driver.

When you run the Instrument Driver Wizard, you need to use niSync.dll and not niSync_32.dll. The niSync.dll is found in the C:\Program Files\IVI Foundation\VISA\WinNT\Bin directory.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 8 of 9
(5,075 Views)
Thanks a lot Jonathon, worked like a charm.  Was able to use the nisync.dll and everything compiled and ran well.

Glad it actually is possible to use C# to communicate with the hardware.
0 Kudos
Message 9 of 9
(5,044 Views)