In need of guidence regarding use of Dynamic Library, .DLL file and .LIB file.

3 ビュー (過去 30 日間)
David
David 2015 年 2 月 22 日
回答済み: David 2015 年 2 月 22 日
Hello.
I know that this subject has been gone through all over the internet, I have quite severe ADD and in some cases like this I feel as if I have all I need right in front of me but I am unable to figure out how to put it all together and I could really need some help.
I have aquired a Analog Discovery(AnD), I know that Matlab alread supports the use of the AnD through Session-Based Interface but AnD can be used for very much that is not allowed through that interface.
Digilents software for the the AnD is named Waveforms, to simplyfie here is a text from the refernce manual:
"WaveForms system is comprised of multiple components.
The most visible component is the WaveForms
Application; a suite of graphical instrument panels that give
full access to the analog and digital instruments in the
connected hardware. The WaveForms application uses
the WaveForms Runtime to control all signal generation
and acquisition. The WaveForms Runtime is comprised of the
DWF Dynamic Library and several configuration files."
I have:
dwf.dll
dwf.lib
and dwf.h
Outside of matlab that is all I need to program the device using C/C++ and the number of different functions that can be called to set up the device as you see fit is monstrous, it really is a quality oscilloscope and function generator as well as digital capabilities. There are many bad things to say about all the USB scope devices sold today and I can not find any other beside this that I like, sure if I wanted to spend a few hundred dollars there are better but for a 100 bucks AnD is just great.
Anyway I want to import the access to Waveforms runtime into matlab, I think it should be so silly simple but my concentration flies of the rail whenever I don't want it to. But then again I might be wrong and the more I search and read the more confused I get.

回答 (1 件)

David
David 2015 年 2 月 22 日
This is how a example provided looks like outside matlab:
int main(int carg, char **szarg){
HDWF hdwf;
double voltage;
// open automatically the first available device
FDwfDeviceOpen(-1, &hdwf);
// enable first channel
FDwfAnalogInChannelEnableSet(hdwf, 0, true);
// set 0V offset
FDwfAnalogInChannelOffsetSet(hdwf, 0, 0);
// set 5V pk2pk input range, -2.5V to 2.5V
FDwfAnalogInChannelRangeSet(hdwf, 0, 5);
// start signal generation
FDwfAnalogInConfigure(hdwf, 0, false);
// wait at least 2 seconds with Analog Discovery for the offset to stabilize, before the first reading after device open or offset/range change
Wait(2);
for(int i = 0; i < 10; i++){
Wait(1);
// fetch analog input information from the device
FDwfAnalogInStatus(hdwf, false, NULL);
// read voltage input of first channel
FDwfAnalogInStatusSample(hdwf, 0, &voltage);
printf("%.3lf V\n", voltage);
}
// close all opened devices by this process
FDwfDeviceCloseAll();
}

カテゴリ

Help Center および File ExchangeHardware Discovery and Setup についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by