Jump to content

how to abtain the array in LabVIEW ?


Recommended Posts

hi

There is a problem in my current work. I just want to use a VI in LabVIEW for computing, that is use a VI to handle some data including array, int, Boolean, ect. The following VI has shown the process of my work. Please look at it.

The VI of Butterworth Filter(BF) is used to handle the data, which are denoted by Input, samlingFreqFs,lowCutoffFreqFl,Order. All of the parameters from c or java. We can use App Builder to build a function prototype after the VI be made, and the prototype is shown as follows:

//the Input array is disposed by BF

//samplingFreqFs, lowCutoffFreqFl, Order are the properties of the BF

void ButterWorthFilter(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, TD1Hdl *Output, long len)

Then I build the VI in to dll file that is convenient to call by c or java!

The above works have finished. However, I don

Link to comment

I see that you are using LV 8.0.1 When building a DLL in the project builder you have full control over all data. Make sure you choose C calling.

I tried your filter, and my header file automatically made by the project bulder looks like (the default, i didn't do any changes):

#include "extcode.h"#pragma pack(push)#pragma pack(1)#ifdef __cplusplusextern "C" {#endifvoid __cdecl ButterWorthFilter1(double samplingFreqFs, 	double lowCutoffFreqFl, double Input[], double Order, double Output[], 	long len, long len2);long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);#ifdef __cplusplus} // extern "C"#endif#pragma pack(pop)

here "len2" is acosiated with Output and len with Input. So they are just ordinary arrays.

Link to comment

thanks, bsvingen

I know what you said. In fact i had done the same function prototype :

void __cdecl ButterWorthFilter1(double samplingFreqFs, double lowCutoffFreqFl, double Input[],

double Order, double Output[], long len, long len2);

now i want to do one thing that how to get the Output array from LabVIEW to C or Java program. That is to say, how does LabVIEW return the data type and program for the realization in c or java?

i guess, in this function, that get the pointer of Output array from the LabVIEW. But i am not sure. I don't know hot to do this!

void ButterWorthFilter(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, TD1Hdl *Output, long len)

thanks to all!

Link to comment

Well, right now i am not sure what your problem is. A DLL is a DLL and a C array is a C array no matter how you look at it. I call to that DLL is therefore like any other DLL calls, and those arrays are like any other C arrays. I would try initializing both arrays in your C/Java program before you call the DLL with them.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.