Dll to generate array

Hi All,
I am very new in the using of dll for Labview so maybe my question is completely stupid. I would like to get an array of values which correspond to a kind of waveform (only the Y part). Here is the part of the cpp program
#include "stdafx.h"
#include <math.h>
#ifdef _MANAGED
#pragma managed(push, off)
#endif
extern "C" _declspec(dllexport) void SquaresWave(double *squares, int samples, double amp, double offset);
void SquaresWave(double *squares, int samples, double amp, double offset)
int step = (int) floor((double) samples/8);
samples = 8*step;
squares = new double[samples];
for (int i=0; i < 2*step; i++)
squares[i]=amp * (2-i/step) + offset;
for (int i=2*step; i < 3*step; i++)
squares[i]=-amp + offset;
for (int i=3*step; i < 4*step; i++)
squares[i]=amp * (i/step-4) + offset;
for (int i=4*step; i < 6*step; i++)
squares[i]= offset;
for (int i=6*step; i < 7*step; i++)
squares[i]=amp *(i/step-6) + offset;
for (int i=7*step; i < 8*step; i++)
squares[i]=amp + offset;
#ifdef _MANAGED
#pragma managed(push, off)
#endif
but when I try to use in Labview it is does not work. Do you have an idea where is my problem ?
thanks
Solved!
Go to Solution.

LabVIEW code interface is not C++ but only simple C. C++ would be a total fiasco as memory allocation by C++ runtime version x is not compatible with C++ runtime version Y. So you could anhow not allocate memory in your DLL to be further handled by LabVIEW.
Standard C has clear rules. Unless you agree to use both in Caller and Callee exactly the same runtime version for things like memory management, you always have to allocate buffers in the caller, even if they are output buffers. So in order to use array pointers you have to allocate the array in LabVIEW, pass it to the function and inside the function filling in the values, being very carefull to write only until the last allocated element in the array and not a single element further.
Or as alternative you can pass the LabVIEW native datatype to your DLL and use the LabVIEW memory manager functions, that are defined in extcode.h (and labviewv.lib). But this last one is an advanced topic and clearly not suitable for anyone not being intimately familiar with both C and LabVIEW.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • [BUG]: Dll modifies input array constant

    Hi,
    Not really an important one, but some of you (Ben might like it... Tested
    in LV6, 6.1, 7.0 and 7.1.
    When a dll function modifies more (1d or 2d) input arrays, one constant is
    used to initialize them and less then all indicators are wired, LV
    overwrites the constant values...
    To reproduce this, I created a two dlls (one in assembler and one in
    LabVIEW, assembler one is attached). The dll fills the array with the number
    2.
    Run the VI, update the diagram (close and open again, or scroll). The values
    in the constant array now have the same values as the output array!
    This behavior is reproducible with (at least) 1d and 2d arrays, and (at
    least) U32 and DBLs.
    I'm sure other array data types (SGL, U8, I8 etc.) s
    how the same behavior,
    but pointers to scalar values do not. Perhaps strings also do this?
    Try putting a flat sequence frame around it, and put a few seconds wait
    before and after it. You can see the constant changing while the vi is
    running.
    Regards,
    Wiebe.
    [Attachment Callbug.dll, see below]
    [Attachment Callbug.vi, see below]
    Attachments:
    Callbug.dll ‏3 KB
    Callbug.vi ‏13 KB

    Ben,
    The topic from the advanced course does seem to be describing this. So this
    behavior doesn't seem to be a bug. I couldn't find anything about this in
    the "Using External Code in LabVIEW" manual.
    When pointers to values are used, the constants are not updated, so that is
    inconsistent, but it does say "may receive", so that is covered...
    Perhaps the only bug is the fact that the block diagram is not refreshed
    properly, after the values are changed... Just kidding...
    Next question is how to make use of this?
    Regards,
    Wiebe.
    "Ben" wrote in message
    news:50650000000500000078D30100-1079395200000@exch​ange.ni.com...
    > Hi Wiebe
    >
    > Your question reminds me of a phrase from proverbs
    >
    > "A wise man goes into his store house and brings forth treasures both
    > old and new".
    >
    > I was not able to find documentaion on the the call library function
    > that talks about this issue but I did find the following in the
    > "LabVIEW Advanced 1 Course Manual, August 1998 Edition, part number
    > 321366C-01 page 242".
    >
    > "If you do not wire an indicator to the output terminal of a terminal
    > pair, LabVIEW assumes that the CIN will not modify the value you pass
    > to it. If another node uses the input data, LabVIEW does not make a
    > copy of the data.
    >
    > Note: If you don't wire the output terminal, the source code should
    > not modify the value passed into the terminal. Nodes connected to the
    > input terminal wire may receive the modified data.
    > "
    >
    > This topic brought our class to a stand still when we(those who were
    > still awake) realized that data could flow backwards through a wire!
    >
    > I believe the behaviour you have observed is correct and the quote I
    > cited above.
    >
    > I will venture a guess that the requirement from the CLA exam
    > "CLD-VPP-03-04 ...Review a LabVIEW application for run-time behavoiur
    > and memory management issue, ....Destructive and non-destructive
    > buffer reads on branched wires"
    >
    > had the behaviour in mind.
    >
    > I posted a Q re:this req years ago but never got a definative answer.
    >
    > All of the above is just my opinion.
    >
    > I would love to hear from others.
    >
    > What do you think?
    >
    > Ben
    >
    > BTW: I do not think they teach that anymore.

  • Question about using for-loop to generate array from DAQmx. Thanks!

    I have a laser system with a frequency of 1kHz, I am using this 1kHz signal to trigger the DAQmx and get the data from a photodetector, e.g. I will get 1000 data points during 1 second from DAQmx, but I need to separate this 1000 data points into the even and odd list, which is two list of 500 data points, e.g.. The 1st, 3rd, ... 99th data is one array, the 2nd, 4th,... 10th data is another array, then I will do further calculations based on these two arrays.
    To seperate the even and odd data, the only way I can find is put these 1000 points into an array and then seperate them afterwards.
    Can I do things like this pic?
    I don't know the speed of the for loop, because the 1kHz trigger is always there, once it is triggered, the DAQmx read will give a data point, if the speed of the for-loop( the time from the end of a loop to the beginning of the next loop) is slower than the 1kHz trigger, then the for-loop will miss data point, then the ordering of the 1000 points in 1 second will be changed.
    Or I need to put everything, e.g. AI Voltage, Trigger, sample clock, into the for-loop and then return a Y? Thanks! 

    Clarification:
    The VI you have posted will work as following:
    1) The task will read 2 analog inputs (ai0, ai3).
    2) The acquisition starts, oncece digital signal (trigger) is detected on PFI0
    3) The sampling rate will be as specified in "rate" control - it is continuous analog input acquisition, which means that after trigger is received (point 2), the board will start to generate hardware clock with frequency you specify as "rate"
    4) with each rising edge of that hardware clock, the measurement is taken, and stored into buffer of driver.
    5) DAQmx read will try to read "number of samples per channel" number of samples each time is called - and if there is not enough measurement stored in buffer (step 4), then DAQmx read will wait until DAQ card will measure reaquested number of samples (or timeout occurs before requested number of samples has been acquired)
    6) DAQmx read will be then called 1000 times - so totaly you will read 1000 * "number of samples per channel"  number of samples.
    You do not have to be worried about speed of the loop. In fact, if you need to read just 1000 samples, with 1kS/s, then you can remove for loop and you can change measurement mode from continuous to finite samples, and specify number of samples to read to be 1000. You will read them all properly. I recomend you to read User Manual for your DAQ device - lets say M Series User Manual.
    I hope it is clear now.
    regards,
    stefo

  • Labview Calling DLL with 2D array input and output

    Hi all,
        I have to call  a dll which a 2D double array as an input and also a 2D double array as an output.The dll is made by me and written in c language , I need it to work  efficiently.
    If i define the program in labview like this
    The 2 2Darrays sent into CLN were "Array data pointer",then how to define the function in c laguage? just like  -----int  myfunction (Parameter1,Parameter2,Parameter3,Parameter4)
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.

    ylongwu wrote:
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.
    Your proposed prototype double ** seems to indicate that you want an array of pointers to the rows of the array. That is not how LabVIEW stores multidimensional arrays (nor how this is usually done in C for such arrays).
    LabVIEW and most C libraries threat multi dimensional array as one single block of memory where the rows are located one after the other. So as DFGray has already pointed out you should use double * instead as datatype or since you create the DLL yourself and if it doesn't need to be compatible with other environments than LabVIEW change that altogether into:
    typedef struct {
       int32 dimSize1;
       int32 dimSize2;
       double elm[1];
    } 2DDblArrRec, **2DDblArrHdl;
    int myfunction (2DDblArrHdl A, 2DDblArrHdl B);
    then change the Call Library Node parameters for the arrays to pass the array as Data Handle (the native LabVIEW datatype) and leave away the extra dimensions since they are already inside the handle structure.
    Last but not least if you want to be very fancy you can even use NumericArrayResize() on the output handle to resize it to the correct size before filling in your information and leave away the Initialize Array function on the LabVIEW diagram.
    Message Edited by rolfk on 05-26-2010 09:11 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Cfg61.dll - Cannot generate forms from Designer

    Hi
    When I try and generate a form from Designer 6i (i am using the tutorial app) i get the following error message :- CDD-23564 : The file "g:\orant\BIN\cfg61.dll" could not be loaded or does not exist. However the file does exist in the specified location. Ive looked thru the on-line documentation and checked the registry but cant see anything obvious. Ive got the following configuration on my machine :-
    Windows NT 4 (service pack 3)
    Oracle 8i (version 8.1.6)
    Designer 6i (version 6.5.28.8.0)
    Any advice would be welcome.
    Thanks
    null

    The configuration looks ok except for Th eService Pack. Designer requires Service Pack 5 or 6 or Wondows 2000 Service Pack 1. Try changing the Service Pack.
    All the best

  • Call dll with 1D array parameter

    Hi, I am trying to interface a Keyence laser displacement sensor controller with labview. Keyence has a dll API and I wrote a wrapper in C with DEV-C++. The wrapper is compiled into another DLL so I can call in my application. (Keyence DLL cannot be called directly for some reason)
    These are tested in Matlab and worked well. The problem is when I try to use the "Call Library Function Node " in Labview, it always report me errors. The C code is pasted as below. The arrays are 1-D and not been resized in the function call.
    Any input is highly appreciated.
    Bo 
     DLLIMPORT int AcqData(float *DataA, float *DataB)
      typedef int (_stdcall *DataStorageStartPtr) (void);
      typedef int (_stdcall *DataStorageStopPtr) (void);
      typedef int (_stdcall *DataStorageInitPtr) (void);
      typedef int (_stdcall *DataStorageGetDataPtr) (int OutNo,int NumOutBuffer, LKIF_FLOATVALUE *OutBuffer, int *NumReceived);
      typedef int (_stdcall *DataStorageGetStatusPtr) (int OutNo, int *IsStorage, int *NumStorageData);
      DataStorageStartPtr DataStorageStart;
      DataStorageStopPtr DataStorageStop;
      DataStorageInitPtr DataStorageInit;
      DataStorageGetDataPtr DataStorageGetData;
      DataStorageGetStatusPtr DataStorageGetStatus;
      HINSTANCE hLib;
      int feedback;
      int OutNo;
      int NumOutBuffer = MAX_NUM_DATA;
      int IsStorageA, IsStorageB;
      int NumStorageData;
      int NumReceivedA, NumReceivedB;
      LKIF_FLOATVALUE OutBufferA[NumOutBuffer];
      LKIF_FLOATVALUE OutBufferB[NumOutBuffer];
      //---------------- Import the DLL --------------------//
      hLib = LoadLibrary("LkIF.dll");
      if(!hLib)
       return -1;
      //---------------- Get the addresses of functions ---------------//
      DataStorageStart = (DataStorageStartPtr)GetProcAddress(hLib, "LKIF_DataStorageStart");
      if(DataStorageStart == NULL)
       return -2;
      DataStorageStop = (DataStorageStopPtr)GetProcAddress(hLib, "LKIF_DataStorageStop");
      if(DataStorageStop == NULL)
       return -3;
      DataStorageInit = (DataStorageInitPtr)GetProcAddress(hLib, "LKIF_DataStorageInit");
      if(DataStorageInit == NULL)
       return -4;
      DataStorageGetData = (DataStorageGetDataPtr)GetProcAddress(hLib, "LKIF_DataStorageGetData");
      if(DataStorageGetData == NULL)
       return -5;
      DataStorageGetStatus = (DataStorageGetStatusPtr)GetProcAddress(hLib, "LKIF_DataStorageGetStatus");
      if(DataStorageGetStatus == NULL)
       return -6;
      //---------------------------- Data Acqusition --------------------------//
      feedback = (DataStorageInit)();
      if(!feedback)
        return -7;
      feedback = (DataStorageStart)();
      if(!feedback)
        return -8;
      sleep(10000);
      sleep(500);
      OutNo = 0;
      feedback = (DataStorageGetStatus)(OutNo, &IsStorageA, &NumStorageData);
      if(!feedback)
       return -9;
      OutNo = 1;
      feedback = (DataStorageGetStatus)(OutNo, &IsStorageB, &NumStorageData);
      if(!feedback)
       return -10;
      while(IsStorageA || IsStorageB)
       sleep(500);
       OutNo = 0;
       feedback = (DataStorageGetStatus)(OutNo, &IsStorageA, &NumStorageData);
       if(!feedback)
        return -9;
       OutNo = 1;
       feedback = (DataStorageGetStatus)(OutNo, &IsStorageB, &NumStorageData);
       if(!feedback)
        return -10;
      feedback = (DataStorageStop)();
      if(!feedback)
       return -11;
      OutNo = 0;
      feedback = (DataStorageGetData)(OutNo,NumOutBuffer,&OutBufferA[0],&NumReceivedA);
      if(!feedback)
       return -12;
      OutNo = 1;
      feedback = (DataStorageGetData)(OutNo,NumOutBuffer,&OutBufferB[0],&NumReceivedB);
      if(!feedback)
       return -13;
      int i;
      for(i = 0; i < NumReceivedA; i++)
        DataA[i] = OutBufferA[i].Value;
      for(i = 0; i < NumReceivedB; i++)
        DataB[i] = OutBufferB[i].Value;
      return 0;
    Attachments:
    program.JPG ‏49 KB
    error.JPG ‏15 KB

    I notice you have corrections dot on the input side. Check the type used then building the array at the input side. Then you build a array on the input side, you do this to reserve memory for the dll. If you have not reserved the correct amount of memory before you call the function an erreor or a crash might happend. A float in C is 4 byte wide, equal to SGL in labview. A double is 8 byte wide, equal to DBL
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Generate array from string

    Hello,
    In my attached array, I wanted to generate another array that just contains the numeric LO Freq enteries.
    This is my original array:
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 136
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    Temp:RM LO Freq: 155
    I wanted to generate the array:
    136
    155
    I was already able to extract the LO Freq numeric values, but need some help to generate the final array together with the array position entry where the LO Freq changes value (in the above case entry 6)
    Thanks,
    hiNi.
    Attachments:
    Freq array.txt ‏19 KB
    extract freq to array.vi ‏11 KB

    Hello,
    I am able to generate the frequency array, but I am having a little trouble implementing the search array to remove the duplicate enteries.  Also, how do I return the array with the position of the frequency change?
    Attachments:
    extract freq to array.vi ‏14 KB
    Freq array.txt ‏19 KB

  • Array into dll

    I built a dll in LV 7. One of the inputs was an array of strings. LV created the following typedef for this input:
    typedef struct {
    long dimSize;
    LStrHandle elt[1];
    } TD2;
    typedef TD2 **TD2Hdl;
    The function prototype generated by LV is:
    void __stdcall AddRow(TD1 *errorInNoError, TD2Hdl *TestResult,
    LVRefNum *WordTableIn, LVRefNum *WordSelectionIn, TD1 *errorOut);
    The question is to call this function, what do I have to pass into the dll from LV? I've tried several ways and it keeps crashing. When I create the dll, it doesn't give me the option to define the input as an array, it just creates the typedef. So when I configured the dll, I chose "Adapt to Type". This didn't work with either "Handle by Value" or "Pointer to Handle". If
    I configure the input as an Array, there is no string type listed (uint32 maybe?)
    TIA
    Bill F

    Hello Bill,
    As an example of this type of program, you might want to check out some of the following links:
    Creating and Calling LabVIEW DLLs with Various Data Types from Microsoft Visual Basic
    Creating and Calling LabVIEW DLLs with Various Data Types from CVI
    Creating and Calling LabVIEW DLLs with Various Data Types from Microsoft Visual C++
    We also have a few example programs that we are working on that are not yet on our
    website. These are example of how to configure a LabVIEW DLL passing string arrays. I attached the ZIP file to this post.
    I hope this helps!
    Liz F
    National Instruments
    Attachments:
    String2Darray.zip ‏24 KB
    LV_string_array.zip ‏75 KB

  • Calling Pulse Generator Matlab model dll in Labview through SIT

    Hi ,
     I have a Matlab model dll which generates PWM output. I Would like to integrate this "dll" through SIT connection Manager and generate the Physical signal.
    But while configuring the Tools->SIT Connection manager->Hardware I/O->Configure NI-DAQ i am getting only Analog input & Analog outputs, but i need Timer/Counter channels.
    Could any one tell what i should do for generating the PWM output with the help of matlab model?
    Thanks
    naveen

    Hi Naveen,
    I apologize that I did not post sooner. I have determined that this is not directly possible. I am actually currently looking for a workaround. This workaround should be possible but may not be all that straightforward to implement. I will post back as soon as I find something.
    Best regards,
    Steven

  • I'm having problems manipulating array data within a for loop, and extracting the required sub-arrays generated.

    Hi,
    I'm using labVIEW V5.1
    I'm trying to generate 10 1D arrays, the first array is initialized to all zeroes, then I have set up a for loop which shifts the first element by 1, then a random number is placed into the first element position. I am using a shift register to feed back in the newly generated array into the start of the loop.
    By the end of the each loop I want to be able to use the array generated in an algorithm outside the loop. However I only want the Nx1 array that has just been generated.
    Unfortunately, I cannot figure out how to resize, reshape or index the output array to do this.
    I would like the loop to
    give me out a 1D array after each iteration.
    Any help would be greatly appreciated.

    I hope I've understood your problem.
    First your vi was lacking of the sub-vi working as shift register, I've replaced it with the rotate function.
    The indexing of your arrays create a 2D array whose rows are your 1D array.To pick only one of them you have to use the index array function and select which one you want.
    To use your temporary data in another part of your application you should use a local variable of array2.
    I did it in a separated while loop That I syncronized with the for loop using occurrence, in this way the while loop runs each time a new value is inserted in array2 (each loop of the for loop structure).
    If you don't need this syncronization just get rid of occurrence functions.
    I place a delay in the for loop to show what happens when running.
    Hope it was helpful.
    Alberto Locatelli
    Attachments:
    array_test_v3.vi ‏35 KB

  • Passing Array of Srings between Visual Basic and Labview dll

    I have searched and searched for the correct way to pass an array of
    strings between Visual Basic 6.0 and a Labview 7 dll. So far, I still
    do not know how to pass the array. When I create the dll in LV, the
    array of strings is presented as a string, not an array. I am familiar
    with passing arrays of type double, but I really need to know how to
    pass an array of strings. Any and all help is appreciated.
    Bob

    Hey Bob,
    From what I understand, that can get kind of messy. You have to allocate the memory in VB in the format that LabVIEW expects (see the externalcode.h file in National Instruments\LabVIEW 7.0\cintools for details). Then pass a pointer to that location to LabVIEW. There are a couple of related examples online. They don't necessarily show how to pass an array of strings to VB, but they should show how to pass a string and an array. I hope this helps.
    Using Microsoft Visual Basic to Call LabVIEW DLLs That Pass String Data Types
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B123AE0CB9B0111EE034080020E74861&p_...
    Using Microsoft Visual Basic to Call LabVIEW DLLs That Pass Array Data Pointers
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3D9E556A4E034080020E74861&p_...
    Regards,
    Chris J

  • Calling a char** array_name type of variable in the DLL.

    Hi,
    I have to call an external DLL from LabVIEW but I have the following issue. One one of the other forum posts, this issue, I think, had been addressed, by I guess editing the DLL itself, or maybe I did not understand the solution right. But I do not have access to the DLL code. I just have the header which has a function definition with char **.
    The "Import DLL" functionality of LabVIEW is mistaking char** for a string, and so I cannot use that too. If I wire a string to the input, then the DLL throws an exception giving Error 1097.
    Calling convention is C.
    The header file has the following function definition:
    DWORD Send(DWORD args, char ** strng)
    So I think the DLL expects an array of Strings. I tried the Type: Array of "8 bit unsigned integers" using "Array Handle" in Call Library Function Node, which led to the following preview:
    uint32_t Send(uint32_t args, Array1DUint8_t **strng);
    Thus I give one string , and convert the characters to 8 bit unsigned array and LabVIEW code looks as shown as below: (Instead of Array of Strings). The input "1" is number of arguments/strings.
    This code runs without error 1097. But my DLL reads the string as random symbols. One example is shown as:
    I do not know why my DLL is reading random things from memory. I am pretty sure its expecting pointer to pointer of character, and may be LabVIEW is giving something different.
    I also tried an array of strings, and used "Adapt to type" in the CLN, but then the output changes from random characters to some number. (Like x5bc087305bc003b5.....
    Any help will be appreciated.
    Also, I have come across posts which say I have to write an external wrapper. I do not want to do anything outside the LabVIEW environment as far as possible, and moreover have almost zero experience in writing one. Thus if a solution in LabVIEW exists, then it would be optimum.
    Thanks.

    You need to know what the DLL expects here: a pointer to a single string, an array of pointers to strings, or something else?  Is the "strng" value an input, an output, or both?  Without an understanding of the function call requirements it's not possible to provide specific advice.  However, it is most likely possible to get this working in LabVIEW.  You will probably need to use DSNewPtr, MoveBlock, and DSDisposePtr.  These are all memory manager functions that you can call from a Call Library Function Node by setting the library name to "LabVIEW" and these functions are documented in the LabVIEW help.  They will allow you to get a pointer to a string, or an array of pointers as appropriate.  You can find one example of using these functions to generate an array of strings in this thread at LAVA: "Passing array of string to C dll."

  • Using a For loop to call one array element at a time

    I have been working on a VI that reads a GPS unit, parses the data, outputs what I need, compares the actual GPS location to the desired location, determines a desired heading and moves on from there.  My question pertains to the number of desired locations I can input right now.  I need to be able to input a predtermined number of locations (not just the one that I can input right now).  I was told that it is possible to use a For Loop with an array and have the first set of Lat and Long values run through the VI and when everything is complete that the next set of values will be chosen.  Does this mean that I need to put the entire VI inside a For Loop and have the array update as soon as the VI has completed its first mission?  I understand the concept of how this work from other programming languages but I'm not sure how to implement the solution in LabVIEW.  Any help would be appreciated.
    Adam

    adamoutlaw wrote:
    Here is a portion of the VI.  I need two separate arrays, one for Latitude and one for Longitude, of the same size.
    I don't see any arrays in your code. Do you want to generate arrays form individual data points or do you want to process arrays, one element at a time? Both can take advantage of autoindexing. Here's a simple picture.
    Your VI contains a weird mix of DBL and EXT precision. Most likely all you need is DBL. Keep your representations consistent!
    Message Edited by altenbach on 08-02-2007 07:14 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Indexing.png ‏4 KB

  • Convert array to fewer smaples per second

    Have large array with 9 channels of data per times stamp.
    Timestamp shows that there are about 100 samples per second.
    I need to generate array that only displays one average value per channel, per second.
    Struggling with "build array" and "indexing" to get proper array.
    Suggestions??
    Solved!
    Go to Solution.

    I might even attach the VI this time!! (V 8.6)
    Attachments:
    Array -channel data.vi ‏9 KB

  • Calling Dlls from LabVIEW

    LabVIEW Gurus:
    I am working with some software engineers who have no experience in LabVIEW. Unfortunately I have little experience in C/C++ to make sense of their inquiry.  
    Basically we are dealing with “Data Marshalling”. I will call a DLL and issue a command (string) and get back a 2-D array and an integer. So far so good.
    The C/C++ programmer requested that I provide them with a pointer/memory address in which they will store data, so I can read it once the dll returns the array and integer. I browsed through the example online http://decibel.ni.com/content/docs/DOC-1690 and thought that if I wanted to read from the dll, the process is a simple as calling the appropriate function and configure the parameter (no pointers needed).
    So, is there a specific way that they need to write the C/C++ code to be used in LabVIEW? Or what else to I have to take into consideration?
    Thank you,
    Santiago 

    That example is pretty simplistic as it only deals with integers. In this case no pointers are required since everything is returned by value. When you're dealing with arrays, however, you need to deal with pointers. If you open the Example Finder (Help -> Find Examples) and search for "dll" you will see the "Call DLL" example. That contains many examples of how to call DLL functions with a wide variety of datatypes. I strongly suggest looking at that example. There is also a chapter in the LabVIEW Help on calling DLLs (Fundamentals -> Calling Code Written in Text-Based Progamming Language).
    You have 2 things to consider:
    You're dealing with arrays - this means you typically need to pre-allocate the memory in LabVIEW, and it sounds like that's what the DLL expects you to do. This amounts to using the Initialize Array function to create your 2D array of the appropriate size and datatype.
    You may be dealing with a C++ DLL. LabVIEW can only interface to C DLLs. This doesn't mean that you can't create a DLL in C++, but it does mean that the C++ programmers need to add an extern "C" modifier to the function calls, otherwise you get name mangling, and LabVIEW won't be able to call the DLL. The DLL programmers should know what that means.

Maybe you are looking for

  • How do I add an appointment sent to me in an email to my Calendar ?

    How do I add an appointment, sent to me in an email, to my Calendar ? Usually I just double clicked on it and it added it automatically ... what has changed ? what do I need to change ?

  • Min Max planning report - ability to run for specific vendor

    Hi, We have a unique requirement wherein business users would like to run min-max planning report for a specific vendor. Vendor here is item sourcing vendor. We are on R12 12.0.4. This version of applications doesnot support sourcing vendor as the mi

  • Sequence dependent setup (setuo matrix) with pooled capacity

    Hi all, We are facing a problem in the sequence dependent setup. We have a pooled capacity in ECC on which we want sequence dependent setup happening in APO. In APO orders are required to be scheduled on this resource and this resource is the primary

  • Converting Properties (java) to hash_map (C++) in JNI

    Hi, Is there a way to convert Java Properties object to C++ hash_map in JNI? Does JNI support conversion of Java Properties object? Thank you.

  • ActiveX && Java

    Hi, I try to embed Internet Explorer in my Java application via JNI. I create child window via C++ code: <=cut=> HWND hWndChild = CreateWindow("AtlAxWin", "Shell.Explorer", WS_CHILD | WS_VISIBLE, x, y, cx, cy, hWndParent, NULL, hInst, NULL); <=cut=>