Discussion:
Programming PCI-1588 via C#
(too old to reply)
HNelson
2008-05-30 15:40:13 UTC
Permalink
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
Jerome30
2008-05-31 17:10:14 UTC
Permalink
I think you should open VS include NI plug-in and then check your functions..
 
HNelson
2008-06-13 16:10:11 UTC
Permalink
First step, How do I include the proper header files/libraries in C#?
Nicholas_K
2008-06-16 20:10:20 UTC
Permalink
Hello HNelson,
body { margin: 0 0 0 0; padding:0 0 0 0 }
td,div { font-family:Microsoft Sans Serif;font-size:8pt;vertical-align:top }
body { margin: 0 0 0 0; padding:0 0 0 0 }
.transcript { background-color:#d2d2d2; }
.messageBlock { margin-left:4px; margin-bottom:3px }
.message { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre; }
.messageCont { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre;}
.other { color:#39577a;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.myself { color:#da8103;font-style:normal;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont { font-size:8px;text-align:right; color:#39577a;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.myselfCont { font-size:8px;text-align:right; color:#da8103;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.system { margin-left:4px; word-wrap:break-word;color:#da8103;font-style:normal;font-weight:normal; white-space:-moz-pre-wrap; _white-space:pre; }
.showTimestamp { margin-right:3px; float:right; color:#999999;font-style:normal;font-weight:normal; }
.other1 { color:#ac2000;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont1 { font-size:8px;text-align:right; color:#ac2000;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other2 { color:#3c9fa8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont2 { font-size:8px;text-align:right; color:#3c9fa8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other3 { color:#e25614;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont3 { font-size:8px;text-align:right; color:#e25614;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other4 { color:#0b6ac8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont4 { font-size:8px;text-align:right; color:#0b6ac8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other5 { color:#b23290;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont5 { font-size:8px;text-align:right; color:#b23290;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other6 { color:#02e7c7;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont6 { font-size:8px;text-align:right; color:#02e7c7;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.other7 { color:#5b3284;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; }
.otherCont7 { font-size:8px;text-align:right; color:#5b3284;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; }
.tsDisplay { display:block }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 <a href="http://blogs.msdn.com/sanpil/archive/2004/07/07/175855.aspx" target="_blank">here</a>. Thanks again and have a great day! Regards,Nicholas K
Jonathan N
2008-06-17 14:10:12 UTC
Permalink
Hi HNelson,
&nbsp;
If you had Measurement Studio, you could use the Instrument Driver Wizard to create a .NET wrapper for NI-Sync.&nbsp; 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&nbsp;niSync.fp file which is located in the C:\Program Files\IVI Foundation\VISA\WinNT\niSync\ directory.&nbsp; The wizard creates all the P/Invoke signautres for you whihc is really nice.
&nbsp;
Anyway, just thought I would throw that out there.
&nbsp;
Best Regards,
HNelson
2008-06-17 15:10:14 UTC
Permalink
Where can I install the CVI support for NI-Sync?&nbsp; I do not have the CVI examples on this computer and forgot how to install them.&nbsp; 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.&nbsp;
HNelson
2008-06-17 16:10:13 UTC
Permalink
I was able to find nisync.fp on the older computer and was able to begin coding is C#.&nbsp; Wrote in a simple program to initialize the card and get time however I received the error regarding nisync_32.dll.&nbsp; I am unable to find it on the computer and am usure of where to get it.
Jonathan N
2008-06-17 16:40:11 UTC
Permalink
To install CVI support, you just need to select the LabWindows/CVI Support&nbsp;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,
HNelson
2008-06-19 15:40:14 UTC
Permalink
Thanks a lot Jonathon, worked like a charm.&nbsp; 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.
Continue reading on narkive:
Loading...