allocation of an array of 2d in labVIEW and move to the DLL function to obtain data

Hi all!

I searched a lot about this, but one cannot find any solution. Please find attached the vi that I try to get a unit of 32 channels data,

100000 samples per channel with 14-bit resolution. And please also find enclosed the header for my dll file. (in the header, it is the GetBuffers function).

There is not a lot of data, it is a little more then 6 MB in the task of LAbVIEW Manager eats about 30 MB more memory, then it should. Are there explanations why?

Because there is much more data in a single channel (million samples or more)

Then I will try to allocate a 2D to data array, but when I try to run my LabVIEW vi crashes.

Could you please help?

Best regards

Tomzi

Dear Tomzi!

To allocate the data in a table in LabVIEW, you must always initialize, as in a you must have a valid entry on cell (x-, y - 1) have a size of table of (x, y). It is usually best to use the function Array initialized for this purpose.

There are ways to pass arrays 2D to DLLs, cand find you examples of both in examples > communicate with external Applications > external Code using the > integrating DLLs > DLL.vi call. Basically, LabVIEW can pass in the form of a big table 1 d 2D tables, so you'll need to spend too much table size index it. If you pass the array 2D handles it is preferable to use the typedef that LabVIEW generates for you, something along the lines of

/ * LabVIEW created typedef * /.
typedef struct {}
Int32 dimSizes [2];
Double elt [1];
} TD1;
typedef TD1 * TD1Hdl;

I hope this helps.

Best regards:

Andrew Valko

NOR Hungary

Tags: NI Software

Similar Questions

  • LabVIEW VI error when executing DLL functions

    Hello OR developers!

    I have driver for windows application created by Jungo WinDriver program for PCI-E card.

    Application works very well. I have edited and compiled the project as DLL manual suite.

    I can read successfully resource information of the PCI-E card such as bars of memory, its size, disruption of functions etc.

    Next, I need to perform DMA transfers. The application supports these functions and works.

    I followed feature-by-feature and see if my code works correctly and he returned to Labview information - successful execution of the function.

    First of all is strange that whenever I close VI I have error message:

    "LabView.exe has encountered a problem and needs to close. We are sorry for the inconvenience ".

    fDebug: 0 Offset: 0083002e

    Exception information

    Code: 0xc0000005 flags 0x0

    Address record 0 x 0 0x0000000000c3002e

    ......................................................................

    ......................................................................

    But when I'm building application EXE of VI - this error do not occur.

    Maybe someone can help me or point on the string I managed properly resources LabView and C?

    LabView block sometimes after a few seconds after successful execution of VI.

    The code below:

    If an application calls a DLL written in a given buffer, the application should allocate memory buffer and release it afterwards. This is the case for all languages, not only for the LV for create a buffer tank one way would be to create a U8 array with sufficient size and to convert the table to a string using the function 'Type Cast'. See the documentation for the DLL for the minimum size of the buffer. Maybe the DLL returns an error code if the buffer size is to small. If you can get the maximum size of the tank messages, add 1 (for the trailing NULL character) as the size of the array U8 and you should be on the safe side. Same for the other settings, especially for tables.

  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

  • How to collect data on the programs of LabView and VC ++ at the same time?

    Hello

    There are two programs in LabVIEW and another is in VC ++. The two programs to collect hardware data.

    Therefore, for the experience, it is necessary to begin to collect data at the same time and lag must be

    less than millisecond (it is essential for the experience). How can this be achieved? BTW, I'm new to LabView.

    I think on the use of network socket to get the message for both applications.

    I was wondering if there is a better way.

    Thank you.

    MARK002-MAB wrote:

    Hello

    There are two programs in LabVIEW and another is in VC ++. The two programs to collect hardware data.

    Therefore, for the experience, it is necessary to begin to collect data at the same time and lag must be

    less than millisecond (it is essential for the experience). How can this be achieved? BTW, I'm new to LabView.

    I think on the use of network socket to get the message for both applications.

    I was wondering if there is a better way.

    Thank you.

    You do not say if two programs access the same material, but I guess not. Because if they did, you probably get conflicts when the two programs try to access the same material at the same time.

    In either case, the only really reliable way to ensure that your needs of< 1ms="" would="" be="" hardware="" triggering.="" one="" hardware="" unit="" is="" programmed="" to="" provide="" a="" hardware="" trigger,="" typically="" a="" digital="" signal="" and="" the="" other="" is="" programmed="" previous="" to="" the="" desired="" start="" point,="" to="" wait="" for="" that="" trigger="" and="" start="" automatically="" when="" it="" is="" received.="" if="" both="" hardware="" units="" are="" ni="" daq="" cards="" you="" can="" do="" that="" fairly="" easily="" using="" the="" rtsi="" bus="" or="" in="" case="" of="" pxi="" the="" pxi="" trigger="" lines.="" if="" they="" are="" different="" hardware="" then="" it="" can="" get="" more="" complicated="" to="">

  • [Database Toolbox] possibility to Load From xml file in Labview and then in the database

    Before you write in my database, I want to save it and reload if the user wants to cancel the new charge that can last several minutes.

    If he cancels the load I get back my previous database data.

    I managed to save my database in XML through the "DB tools SaveRecordSet To File" VI. This VI records directly contains my database table in the xml file. And finally, I only if the other VI to load file will do the same thing, means load the file and save it in my database but it gives just a recordset in labview.

    Question: is it possible just to load the xml file into the database directly through Labview?

    Why, finally, these screws do not have the same behavior?

    I don't know, but I just thought I would chime, that if you fail to do with LabvIEW, you might want to look by making your writing in a 'Transaction' database, if your DBM takes in charge (most except MS Access)

  • Operator Interface labview and teststand back the call for promotion of status sequential

    Hello

    I am looking for a solution to be able to take by the API Testand 'call sequence' status key of my teststand sequence.

    The idea is to combine, on my operator labview interface a specific indicator pour each call sequence 'important '.

    Example: an indicator to test consumers, another for power supply, an another SoftComm ex but not pour tests under

    The first solution that comes to me and inspired by what I could find on this forum is the utilistion method PostUIMessageEx en post expression for each call sequence don't I want to get the result.

    I find this solution satisfactory sector a bit heavy and a little too dependent on the test sequence she herself.

    Other solutions of would they?

    Please pour your contributions

    Hello

    In general, I get the UIMessage TraceCallback. So based on the name of the step (say consolidated test for example) I can do whatever I want since LabVIEW update my GUI without having to change the TestStand sequences.

    Kind regards

  • LabVIEW crashes after the call to the DLL

    Hi all

    I'm working on writing a wrapper for a dll. The call to the dll works fine a returns the appropriate values, but as soon as I close the VI dev LabVIEW environment crashes. Any help to avoid the same. I've been through a lot of posts and I tried varying the types of data sent to the dll, but again it gets crashed.

    the dll function that I use is the prototype (with the calling convention of type C)

    int nomfonction (Struct * cfg, UCHAR dNumber, UCHAR hTYPE)

    The varables UCHAR I'm passing as of 8-bit unsigned integers.

    For the structure, I did a cluster and pass with adapted to the Type and handles.

    The DLL is running very well and the VI stops, too, but as soon as I try to close the dev environment VI crashes. Help, please.

    Thank you.

    It is always possible that there is a bug in your DLL, or you're a failure calling a function in the DLL that is required in order to properly clean. The problem is perhaps not the way you have set up the call library function node.

    If you post: your VI; the header file that defines the structure of the cfg and the function prototype; and all the documentation on the function, so we can tell you if it is properly configured. Without this information there is little we can do.

  • Communication between PCI6251, Labview and Matlab

    Hello

    I work with a Council of PCI6251, driven by an executable labview.

    I get measurements from several sensors (pressure, temperature, etc.) which are read by the executable of labview.

    I would like to know if it is possible to send these Matlab measurements at the same time.

    I mean: is the PCI6251 card can send data to Labview and Matlab at the same time of acquisition?

    Or I need to install a second PCI card for that?

    (Labview and Matlab are installed on the same PC now)

    Hi Nico974,

    If you want to transfer data from LabVIEW in MATLAB, you have to use ActiveX connection between 2 software or to add the node to MATLAB in you program LabVIEW (see http://digital.ni.com/public.nsf/allkb/2F8ED0F588E06BE1862565A90066E9BA?OpenDocument)

    Another solution is to use the of MathWorks Data Acquisition Toolbox, because the card PCI-6251 is supported by this Toolbox (http://www.mathworks.fr/products/daq/supportedio14005.html)

    But here you have a LV executable so if you can't change it you will not be able to use your exe and a Matlab Script at the same time, if you need another PCI card.

    Sincerely

  • Call the function in LabView from a DLL, and then access the global variable of DLL

    I've created a DLL in LabWindows with a function and structure.  I want to call the function from LabView and then access the overall structure.  I am able to call the function in the DLL with a "call library function node" and has access to the return value, but I can't understand how to access the overall structure.  The structure is declared in the header DLL with __declspec (dllimport) struct parameters file.

    Is it possible to access this structure without using the library of network variables?

    My guess is that you need two bytes of padding after "in_out" and another to two bytes of padding after "anin."  The reason being that ints are 4 bytes, and most of them C compilers will align on 4-byte boundaries.  The struct will naturally start to such a limit (in fact, in Windows, it will probably start to an 8 byte boundary).  If you then count bytes in your structure, you are 70 byte after "in_out."  70 is not divisible by 4, so you need 2 bytes more to reach the next 4 byte boundary.  You can also you could reorganize your struct so that "anin" follows "in_out" and this is probably the best option if it won't cause you other problems.

    Unlike most C compilers, LabVIEW compressed structures as closely as possible, without filling.  I don't know enough about the history of LabVIEW and internal parts to explain the reasons and to do this performance penalty, but, as choice of LabVIEW "endianness", it is probably a remnant of the first versions of LabVIEW that were running on the Mac.

    If for some reason you want to force your C struct to match package LabVIEW, you can use the #pragma pack (x) directive, but I wouldn't recommend that here because you can control the C and LabVIEW.

    EDIT: in the cases where it was not clear, add padding to your cluster of LabVIEW, insert appropriate size or items at the place desired in the cluster.

  • The interface of LabVIEW and matlab

    Hello, I want to interface LabVIEW with MATLAB using the TCP/IP protocol for data transfer. Can anyone, please give me an instruction step by step how to do this? If not, can point out you where I can get them? Thank you.

    Hi Gilles,.

    TCP/IP is a generic protocol then you should easily be able to build enough interfaces TCP/IP for your LabVIEW and Matlab code and data transfer on ASCII or variants, etc., depending on what kind of data you are trying to transfer. I'm not too familiar with Matlab, but on the end of LabVIEW, there are a few examples of server and client very good TCP/IP provided with LabVIEW.

    Another option you may want to, and the reason why I answer it is that I did recently a project through which we took some legacy code MATLAB which we wanted to transpose into LabVIEW, so that we can automate then completely a test system that we use TestStand. A big part of it, we have been able to derive equivalent LabVIEW, but some functions where LabVIEW does not have an equivalent appropriate, or where it was simply more effective, simply copy us and paste Matlab code in any event in the first instance MathScript nodes (not dependant on Matlab) or Matlab script nodes (which will return if all goes well at a later date to transpose in full) LabVIEW for that is no longer dependent on a Matlab license).

    In both cases, the facility to do this was very impressive, and we were able to wrap huge amounts of code Matlab LabVIEW with very few problems. As an idea, have you considered your functionality of Matlab of packaging in this way and keeping all the customer TCP/IP and comms server in LabVIEW?

    Note: If you have not found it pick up the palette "Matlab Script.

    Good luck

    David

  • How Labview grab handles in the array?

    I have an array of large 2by2, and I do a lot of travel such as the removal of the top row and add the data to rank the lowest. The size of the array never changes, but I manipulate the data a bit.

    My question is: how Labview manages this manipulation? Is this just smart enough to manipulate pointers rather than copy the values over and over again?

    I'm looking at the interface with the dll, and it would seem that Labview for a 2by2 arry have only a pointer to all the numbers such that the number is simply distributed over a block of memory. Is Labview all done with any size chart? Just store in a large part?

    Thank you!

    d1sturbanc3 wrote:

    I have an array of large 2by2, and I do a lot of travel such as the removal of the top row and add the data to rank the lowest. The size of the array never changes, but I manipulate the data a bit.

    My question is: how Labview manages this manipulation? Is this just smart enough to manipulate pointers rather than copy the values over and over again?

    I'm looking at the interface with the dll, and it would seem that Labview for a 2by2 arry have only a pointer to all the numbers such that the number is simply distributed over a block of memory. Is Labview all done with any size chart? Just store in much?

    Thank you!

    Yes to the most, "depends on" the rest of your questions.

    Operators of memory "inplace" you will work within a single buffer. Some of the normal array operators will do the same (replace the subset of table for example). Build table, no.

    Try to use "tools > profile > buffer Allocations... Show.

    To see where you have additional buffers in your code.

    BTW: The process using «Show the buffer...» "and then rewrite to eliminate is sometimes called"Chase points ".

    Have fun!

    Ben

  • Error during transfer of an array of Clusters for LabView

    Hello

    I'm new in LabView and I hope that this mistake has an easy solution.

    I built a VI to check the validity of a label.  The Vi receives an array of clusters.  The cluster has 3 strings.

    I built a Variable with an exact same structure in TestStand.

    I get the following error:

    Error, parameter 'Sn Range Array': array elements "FileGlobals.SN_Ranges" do not correspond to the LabVIEW or cluster cluster is disabled in the definition of the array element type. [Error code:-17313, could not accept the parameter passed.]

    Is attached a sequence with a single step.  and vi.  (the location of the vi must be re assigned to TestStand).

    Can anyone help solve this error?

    Thank you

    Rafi

    Thank you

    your advice was perfect...

    Concerning

    Rafi

  • How to import an array of strings of labview in DIAdem spreadsheet/table

    How to set up a model of tiara so when you use labview express of tiara, the values are imported into a table.

    I have values such as gain, cut-off frequency and success/failure that exist in tables generated by the collection of information by a system of 7 EEG electrodes.  I want to create a table/worksheet in tiara that imports the data by using the DIAdem of LabVIEW express function, in a table or spread sheet?

    Notice to lovers?

    Hi eximo.

    The express block DIAdem report makes it easy fill the text boxes and the 2D graphics in DIAdem of variables (son) in LabVIEW.  Unfortunately no paintings 2D or 3D graphics are implemented in the express block DIAdem Rerpot.  So, you have 2 options.

    Option 1: If you do not have too many channels that you want to display, you can agree that several text boxes in the form of a 2D array and the use of the DIAdem report express block as it was planned (sending data to it by sons of LabVIEW).

    Option 2: at some point as you continue to add items to your report, you'll probably end up here.  The express block DIAdem report was designed to connect wires of LabVIEW with simple reports of DIAdem.  But there is a hook that you can use to run a VBScript script rather than load a REPORT model in DIAdem report express block *. File TDR.  With a DIAdem of VBScript, you can accomplish anything in tiara.  In addition to wiring up a way to VBScript instead of a path to the REPORT model, you will also need to send all the data you want to report on a TDMS file and have DIAdem read data from this file, instead of receive data directly from the LabVIEW of wire to the terminal of express block entry.  It's a little more complicated, but it will do absolutely everything you want in DIAdem and start this report of LabVIEW.

    I enclose an example of Option 2, but I'd be willing to help you adapt to your data and reporting needs if you are going to post or email ([email protected]) your data set and a rough *. File TDR that you want in the REPORT.  It's pretty slow here at the office at Christmas, so I have time...

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • Array of strings in the container will not pass in an array of strings in LabVIEW cluster

    I'm new to TestStand, but I'm a CLD.  I took a course custom 3 days which covered most of the TestStand Core 1 and some of the Core 2.  I use TestStand 2013 and 2013 of LabVIEW.

    I have a VI that needs a supply of a cluster that contains, in the following order:

    D 1 string array named Column_Labels

    Table 2D-double named Results_Data

    D 1 table of paths named Graphics_File_Paths

    D 1 table of Boolean named Pass_Fail

    I created a custom data type called Maxim_Results from the tab module VI in the TestStand sequence.  When I have a local (MINSYS_Reuslts), which is made from this Type of reference, I get the following error:

    No corresponding subproperty to the 'Locals.MINSYS_Results' of type 'Maxim_Results' argument for the element "Maxim_Results.Column_Labels" of the cluster

    If, however, I make reference to each item container for each item separately cluster there is no error:

    Can someone help me understand why this is happening?

    Hey Kelly,

    I just implemented the situation you described and it worked correctly for me. However, I noticed that in your example where you have referenced each element individually, your element Column_Labels is actually called "Column_Lables". If it was also misspelled in the LabVIEW Cluster parameter from the custom type, he practiced the behavior you're seeing. This could possibly be the case?

  • How does the library function call Labview? Can I emulate using C++?

    Hi all. I recently finished writing a dll CUDA for LabView, and now I'm in the steps of optimization of code, memory management, etc. BUT since my code depends on the entries of Labview (lots of data under types of specific data as table manages and Clusters labview) I can't use the CUDA Profiler or the Profiler VC ++ on the DLL. What I intend to do runs labview and then out of all data entry for the DLL in a binary file and then add an additional function in my code that will read in the binary file, allocate and assign variables to their respective positions, and then call the specific DLL function in Labview. In the end, this miniature function will act as the library function call to my specific group of data entries.

    In any case, I started to make this purchase all my data entry of cluster and it comes out in a binary file. And then I started the initialization of the handles of labview, allocating memory and begins to write the binary data in the memory and it works for integers (ints), floats, etc., but I'm confused on how it works with table handles!

    Some examples of code:

    Sets the Handle for table 1 d for INT
    typedef struct {}
    int length;
    int val [1];
    to access the value in a row-online val [Online]
    } Array1dInt, * Array1dIntHandle;

    int main()
    {
    Array1dIntHandle x = new Array1dInt *;
    (* x) = new Array1dInt;

    ifstream file ('TESTDATAIN.dat', ios: in | ios::binary);

    If (file.is_open ())
    {
    file ((char *) &(*x)-> length, sizeof;)
    file ((char *) &(*x)-> val [0], sizeof (int) *(*x)-> length);

    LabviewSpecificFunction (x);
    leader. Close();
    } else
    {
    < "file="" did="" not="" open!"=""><>
    }
    return 0;
    }

    __declspec(dllexport) LabviewSpecificFunction (Array1dIntHandle x)
    {
    ...
    }

    However, my program crashes when the table is nominally big, and it is expected, because if we look at the Array1dHandle, it has allocated only enough memory to 1 item of value! YET, somehow, in its magical and mysterious labview is capable of making val [1] be val [HOWEVERMANYYOUWANT], even if C++ 101 says that val [1] is a constant pointer, and even if I dynamically allocated memory another somwhere, I would never be able to put these data in this round!

    Can you explain, or maybe even write example on how I can fool my program into thinking that the binary code comes from labview, so I can then run my program independent of allowing me to profile the functions inside labview?

    I hope that this question is clear and my sample code is also clear, but I'm happy to answer any questions that relate to this.

    Thank you all!

    I think that I thought about it.

    Array1dIntHandle x = new Array1dInt *;
    int tempsize;
    file ((char *) & tempsize, sizeof;)
    (* x) = (Array1dInt *) malloc (sizeof (int) + sizeof (int) * tempsize);
    (* x)-> length = tempsize;
    file ((char *) &(*x)-> val [0], sizeof (int) *(*x)-> length);

    Well enough, you will need to make the handle, and then make a new Array1dInt * for him, then read in the length of the array in a temporary variable. Then use this information to then malloc memoery quantity you need for the table and pass this place on the handle. Now the handle will point to the size of the memory and you will be able to access the memory in the format, you've done the handle. Badabing badaboom

Maybe you are looking for