Jump to content
  • 1

WaveForms SDK with C#


Anthony

Question

5 answers to this question

Recommended Posts

Hi @Anthony,

The WaveForms SDK contains examples in Python and C.

The examples are by default are is installed to:
- Windows: C:\Program Files (x86)\Digilent\WaveFormsSDK or C:\Program Files\Digilent\WaveFormsSDK
- Linux: /usr/share/digilent/waveforms/manual and samples
- OS-X: /Applications/WaveForms.app/Contents/Resources/SDK

As far as I can tell there is not any examples for C#.  Here is a forum thread that talks about a forum member being able to use VB 6.0 with Waveforms 2015 and what they had to do to accomplish it. I believe you would need to something like this. ( @attila could you correct me if I am wrong).

cheers,

Jon

Link to comment
Share on other sites

Hi @Anthony

I just created a C# wrapper for the DWF library. Add the following files to your project:
dwf.cs
dwfPINVOKE.cs

 

The custom applications use the WaveForms Runtime. This is by default installed with the WF installer: https://reference.digilentinc.com/waveforms3

You can find the manual in WaveForms SDK and examples in Python and C. C:\Program Files (x86)\Digilent\WaveFormsSDK\

The C# usage looks like this:

int hdwf = 0;
dwf.FDwfDeviceOpen(-1, ref hdwf);
dwf.FDwfAnalogInConfigure(hdwf, 1, 1);
while(true){
    byte s = 0;
    dwf.FDwfAnalogInStatus(hdwf,1, ref s);
    if (s == dwf.DwfStateDone) break;
}
const int cData = 8192;
double[] rgData = new double[cData];
dwf.FDwfAnalogInStatusData(hdwf, 0, rgData, cData);            
dwf.FDwfDeviceCloseAll();

 

Link to comment
Share on other sites

I am really sorry to interrupt you.

 

In the process of cleaning up old hard drives I found my take on the C# interface to WaveForms SDK (from year 2014) and put it up on GitHub, https://github.com/Andrei-Errapart/WaveFormsSDK

The difference is that I have taken the trouble to turn errors into exceptions, which some might dislike. Other than that it is also one-to-one mapping to the SDK.

The license is MIT, which is quite permissive - many companies use libraries licensed under MIT.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...