Exception in the external code called by calling the library function node problem

Hello, I am a complete newbie in LabVIEW and need help. I have run tests of reliability and get this error about 2000 cycles. The code sends the digital output of a cylinder which operates the actuator downwards, he reads a signal of the thing I'm testing. Then there is a signal to then drive the actuator to the top and repeat. After about 2000 cycles, I get the error:

[LABVIEW: an exception occurred in the external code that is called by a node call library feature.] It might have corrupted the memory of LabViews. Save all work to a new location and restart LabView. VI "Footswitch.vi" was arrested at the node 0 x 0 of the Subvi "DAQmx Start Task.vi 7"]. "

I created this code without any prior knowledge of LabView, so I know it's not good, but it does not have (somehow). Any help would be greatly appreciated. Thanks in advance. I am also attaching the VI.

cstemm,

There are a few obvious errors in the code that must be addressed.  First of all, I'm not sure how your code even survived 2000 cycles, you have a Boolean value enter these while loops:

What happens if you read a false? The curls will be stuck in an infinite loop... as the value read from the tunnel will never change, and the stop condition will always be "false".   I think that what you do... was keep reading the numerical value until it is true, so it's what needs to be in a while loop.

Now, the problem you are experiencing is most likely a result of mass overload of start/stop tasks.  For these digital readings, simply start the task once and stop the task once. Run the start task until your main loop work... reference col in the task and read when you want to. Then, when the main loop is completed, go to this thread of task outside the while loop to clear tasks and stop.

Programming paradigm is generally (there are exceptions):

Initialize (startup tasks, the initial set of controls, etc.) -> the main loop (here, most of the code is readings/writings/calculations)-> References(stop tasks, clear data, close any open file references) close

You don't do any reads buffered of digital lines, so no need to ever stop or restart the task, it gives you just a value whenever you call playback vi.

Tags: NI Software

Similar Questions

  • When I use the library function node call in real time, is loaded only once for all or load the DLL whenever it is called?

    When I use the library function node call in real time, is loaded only once for all or load the DLL every time when it is called?

    I have a critical application in real time, in which I use a piece of DLL function developed in C++.  It is ok?  Make sure any senior developer?

    Thank you in advance.

    The user interface thread is the thread that is used to update the user interface. It's slow. And it's supposed to be that way because humans are slow.

    The call library function node can be configured as this thread to use in the configuration for it dialog box. Please visit the LabVIEW documentation on how to do this.

  • Despite indicating to the path, still have manually pointing DLL every time LV works using the library function node call

    I use the node of the library function call in LV 8.6. I checked the path to specify the box diagram and made directly in the DLL file that I use. Whenever I have started with Labview, I have to go to the diagram and physically find the DLL in one of my calls to make it work properly. Once I have do this everything seems to work as expected. Anyone else see this issue? Any suggestion would be appreciated.

    Thank you

    Steckman wrote:

    I use the node of the library function call in LV 8.6. I checked the path to specify the box diagram and made directly in the DLL file that I use. Whenever I have started with Labview, I have to go to the diagram and physically find the DLL in one of my calls to make it work properly. Once I have do this everything seems to work as expected. Anyone else see this issue? Any suggestion would be appreciated.

    Thank you

    Probably that DLL does not depend on other DLLs that reside in the same directory you point to in the configuration node dialog box call library. What is happening is this:

    Without going into this directory:

    LabVIEW applications Windows to load the DLL, Windows detects that it needs to load other DLLs and can not find in its standard search sites:

    (1) already loaded into memory

    (2) in the application directory (where the exe that began the current process resides in the LabVIEW IDE would be where is LabVIEW.exe)

    (3) in the system directory

    (4) in the Windows directory

    (5) any directory in the PATH environment variable contains

    (6) in the directory 'active '.

    Because Windows cannot find a person to load DLL he abandoned the main DLL loading and returns an error to LabVIEW.

    Now, you go to the configuration dialog box and point to the DLL. The dialog box browse file in LabVIEW uses the standard OS dialog box and this dialog box has the behavior obnoxious always update the "current" directory in the directory where a file got selected in. LabVIEW sees now that the path has "changed" and asks again to load the DLL. Yet once, Windows detects that it needs to load other DLLs too for this DLL but this time going over the search order, it will actually hit the DLL in the same directory and that's all fine.

    It is certainly NOT a problem of LabVIEW. LabVIEW does not and should not really need to know that a DLL needs other DLL loaded and more importantly should never try to think he can do better than Windows, it probably could, but is simply not his task of dependency DLL loading.

    It is your responsibility as a programmer and user of this DLL to know its dependencie, and if you did not write the DLL, to hit the original on his head programmer, if it has not documented these dependencies and make sure that these dependencies are actually properly resolved for Windows placing them in one of the places mentioned above

    ((2) is generally the best location for applications applications because it will not pollute the Windows directory or the user of the application system and 5) is the best for the development machine as you can add a directory to your PATH environment variable where you put the dll you need to develop a specific application.

    Rolf Kalbermatter

  • call library function node to paste files

    Hello, I use the call library function node to paste the text to and from the Clipboard and works well.  Now, I'm trying to figure out how to paste a file from the windows file Explorer.  So if I highlights a file in the Windows File Explorer and press Ctrl-C, how can I use the library function node spit a file path?  It would be even better if I could highlight a bunch of files and then paste a table of paths, but that can wait.  Also, I use a Listbox MC, so I can't use drag-and - event trigger move a control path of the file.

    Also, I use WinXP and LV 7.1.

    Thank you

    Pat

    UPDATE

    I had little time to play with it and really out of curiosity on my part that I have whipped up a simple example to drag and drop from the Explorer in LabVIEW. I wrote the code in 7.1, but I have 7.1 on a virtual machine, and the DragQueryFiles did not work. I don't know if it was due to the fact that I was running on a virtual machine. I did, however, run the code in 8.2 and it works correctly. 8.2, I was able to drag a bunch of files in front of the VI, and the string table fills with file names. I am especially to see if it might work for you. You will need to get the Windows Message Queue library. Simply place the library in the same folder where you unzip the attached file.

  • How to use the node to call a library function to convert C++ source codes

    Hi all

    There are two dll name 'QMSL_WLAN_Transport.dll' and 'QCAMSL_MSVC10R.dll' and some codes c ++ to connect to the DUT. The two DLLs work together for communicaite with the DUT.

    I am confused as how to use the node to call a library function to load the 'QCAMSL_MSVC10R.dll' function as

    g_hResourceContext = QLIB_ConnectServer_UserDefinedTransport((HANDLE) USER_HANDLE,
    UserDefinedSend,
    UserDefinedReceive,
    UserDefinedFlushTxRx,
    true,
    true);
    

    It seems that 'UserDefinedReceive, UserDefinedSend, UserDefinedFlushTxRx' Processaddress?  And "UserDefinedReceive, UserDefinedSend, UserDefinedFlushTxRx"'s functions in 'QMSL_WLAN_Transport.dll '.

    UserDefinedReceive = (_UserDefinedReceive)GetProcAddress(hUDT,"UserDefinedReceive");
    UserDefinedSend = (_UserDefinedSend)GetProcAddress(hUDT,"UserDefinedSend");
    UserDefinedFlushTxRx = (_UserDefinedFlushTxRx)GetProcAddress(hUDT,"UserDefinedFlushTxRx");
    

    Attached DLLs and C++ code snippets.

    Need help.

    Thank you.

    These parameters are reminders - pointers to functions that are called by the DLL - and there is no way to duplicate this purely in LabVIEW. Search this forum for the word "recall" and you will find similar questions (for other DLLs). You will need to write your own DLL (in C, C++, etc.) that implements these functions and provides a way to transfer data to LabVIEW.

  • 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

  • What is the right way to specify the location of the shared library in an a .lvlib function call library function node?

    I'll have a bit of a problem with how to specify the location of library shared in a call library function node it is a VI that is part of a library of LV. Here's a little background which may help.

    I do a lot of measures using spectrometers photo from several manufacturers.  Someone in my company developed a C DLL library, which provides a simple API for all the different spectrometers. To facilitate this DLL to use in LabVIEW, I wrote a .lvlib that wraps all the functions.  When I want to use the API, I simply include the .lvlib file in my project that allows me to drag and drop the wrapper s VI on my block diagram. When I created the .lvlib of VI, I specified the path in the call library node. /. * so it will always look in the local application to the DLL directory when I run.

    The problem is, when I load demand, LabVIEW you asks for the location of the DLL even if it's just there in the local directory! I tried to put copies of the DLL in the directory with the .lvlib, but he still refuses to find the DLL loading.  What I am doing wrong?

    You should in this simple case enter the full path to the DLL by navigating to it. If the DLL is on the same volume/drive that the VI containing the call library node LabVIEW will be internally store the relative path from the VI to the DLL (but still show the absolute path). If you move the DLL and screw together (so the relative location of the DLL to the VI remains the same) LabVIEW will always find the DLL.

    I don't think that the lvlib would add nothing to that.

  • VI Analyzer: the wire under the test object fails with call library function nodes

    Hello

    If I have a knot of function call with an ErrorIn and an ErrorOut library, the VI thread Test Analyzer "Thread under object" always fails with two hits in a library function node call.

    Double click to the salient facts occurrence lines error related to the call... node.

    The test fails, if the error lines are not connected.

    Thank you!

    H

    Sorry, created the CAR number is #208992.

    Kind regards

    Michael

  • Return an array of strings of call library function node

    Hello

    I'm having a few problems getting the following work.

    I have a camera from a manufacturer that came with its own .dll and header files. I'm calling the LabVIEW .dll file (2011). In total, there are about 50 functions, and there is a rest that I can't go to work (probably because I understand enough about the topic to interface with an external code).

    The description of .dll is delivered with the following text:

    #define length

    #define MAX_CONFIGURATIONS

    Prototype: int ConfigListGet (char (& sConfigurations) [MAX_CONFIGURATIONS] [length]);

    and the header file with:

    extern "C" __declspec (dllexport) int RepRateConfigurationListGet (char (& sConfigurations) [MAX_CONFIGURATIONS] [length]);

    The function should return an array of strings to the list of configurations.

    The problem I have is that I can not understand how to return the array of strings for the node of the library function call to LabVIEW. I looked a little on the web and the examples in LabVIEW and I can't find anything specific to return an array of strings in this way, so if anyone can point me in the right direction I would really appreciate it.

    Also, if I click with the right button on the node library function call and click on "File Create.c", I would be able to create the prototype of function even that above? I tried this but no luck. Was the closest I came:

    int32_t RepRateConfigurationListGet (char sConfigurations [], uint8_t MAX_CONFIGURATIONS, uint8_t MAX_LEN);

    Thank you very much in advance for any help!

    D

    Hello!

    I tried once using an array of U8, converting it to a string and then split into an array.

    Here is my old piece of code (the split part can be cleaner ;=))

    Kind regards

    Marco

  • Crash when moving from a structure in a call library function node

    I am trying to use a type of Fortran (which I think is similar to a struct) in a LabVIEW call library function node.  I read a few remedies to this topic, but I'm not quite sure if I need to add the name of the parameter list of the node structure.  Now, when I run my VI it closed just LabVIEW entirely with no message.  I've attached the VI that I use and code source fortran, which compiles in my .dll.

    Any help is appreciated.

    Do you know if Fortran passes parameters by value or by reference?  I never used it.  A very quick search on the internet gives to think that the parameters must be passed by reference.  If this is the case, then you must pass the entire cluster as the parameter single, similar to Fortran statement.  You must also change the order of cluster to match the order in the Fortran statement.  Try the attached VI.

  • Loading of the DLL string using the Code Library function node

    I experience now with the element of Code Library function node... what I wanted to do are, for example, I have compiled a. DLL file... which has a function that returns the pointer to string... function looks like:

    / * This function returns a pointer to the character string * /.

    char * pchar (int n)

    {

    char * str [] = {"error", "String1" and "Word2", "3"};

    Return ((n! = 1) & (n! = 2) & (n! = 3))? Str [0]: str [n];

    }

    but when I load into LabView DLL, a part of the chain on the screens to Panel frontal trash... any ideas why?

    p.s. when I do even with integer values... say my job is like int x = 5; Return x; and then I load in LabView to the digital indicator... it works great!

    So any ideas?

    thanx

    Cyrax says:

    I experience now with the element of Code Library function node... what I wanted to do are, for example, I have compiled a. DLL file... which has a function that returns the pointer to string... function looks like:

    / * This function returns a pointer to the character string * /.

    char * pchar (int n)

    {

    char * str [] = {"error", "String1" and "Word2", "3"};

    Return ((n! = 1) & (n! = 2) & (n! = 3))? Str [0]: str [n];

    }

    but when I load into LabView DLL, a part of the chain on the screens to Panel frontal trash... any ideas why?

    p.s. when I do even with integer values... say my job is like int x = 5; Return x; and then I load in LabView to the digital indicator... it works great!

    So any ideas?

    thanx

    You cannot return a pointer to the data stored on the stack. At the time when the function returns, the stack is reset to the State before the call to the function and in a multithreaded as LabVIEW environment probably long reused for other things when LabVIEW gets around to actually copy the returned pointer data.

    Since it is a read-only variable, you could create a permanent memory for string storage by declaring your variable static. This will create a memory area allocated globally for the string data (and also cause a compile error when you try to write in this area somewhere in your code, which is a good thing).

  • Call library function node

    When using a call library function node, and the program came out, I get an error "has encountered a problem and needs to close" having to do with ntdll.  It does not stop the program from running properly, but it's annoying.  Any ideas?

    You should NOT specify the full path to a DLL system in the configuration dial the node of the library. This mess something in the newer versions of Windows. Instead just enter the name of the DLL only. It is sort of a bug in LabVIEW not automatically detect the system paths and shorten the path accordingly in itself, but this is how things have been for a long time and you just need to be a little careful.

    Also the return value must be really set up to be an integer of size of pointer, since a HANDFUL is really a pointer under Windows and that the first parameter is also better configured as such. The way you did works very well for LabVIEW 32 Bit but will misbehave in LabVIEW 64 Bit.

  • help with call library function node

    I have problem with node function call library that I try to use velleman k8061 dll file to get this working labview

    all I'm trying to get the same problem

    but I chose one to explain it

    SetDigitalChannel
    Syntax
    PROCEDURE SetDigitalChannel (CardAddress: Longint;) Channel: Longint);
    Parameters
    CardAddress: The address of the previously opened card.
    Channel: Value between 1 and 8, which corresponds to the output channel to be resolved.
    Description
    The selected digital output channel is activated.
    Example of
    BEGIN
    SetDigitalChannel (0, 1);

    now, when I try to call the function of library in k8061.dll node and set up 2 a card address and one for the channel

    address of card type: type numeric & statistics: signed 32 bit intger

    channel type: numeric type & data: signed 32 bit intger

    function prototype

    void setdigitalchannel (int32_t, intg32_t channel address);

    I also configure error call library function node checking up

    now that I run it, I get error 1517 produced and tell me this mismatch between the calling conventions?

    problem solved

    thanx

  • How to read / write to a HID device with call a library function?

    I had tons of problems to read from a device USB HID in VISA. I had no problem make a driver for him and write it in LabVIEW. However, whenever I try to read using Read Visa, Visa USB Control In or interrupt USB event get different types of error messages.

    I decided to give up this route and talk to the device through hid.dll, setupapi.dll and any other .dll that I need to use. The problem is that I'm not sure I correctly use the nodes to call a library function... I've seen several KB articles that explain how to set up the nodes call library feature, but I need more information. I can configure stuff and sometimes get things to work, but I don't always know what each specific selections in Settings tab is doing. Can someone give me more detailed information on what do the settings tab and all of its components?

    Thank you

    Matt

    Have you looked HERE?

    Shane.

  • Disable the use of structure in a lead time library function node increases

    I found that if I use a stureture disable to disable one of the outputs of a library function node call, the run time will be greatly increased. Can someone explain this?

    You can read this thread and benchmarking, I did there.

    Turn off debugging and check if the loss of performance you MENTION (but not quantified) is still there.

Maybe you are looking for

  • Beats Audio Control Panel does not work

    I have a pavilion dv6-1149wm Service Pack 1 of Windows 7 and can not access the beats audio Panel after and idt driver update. How to use beats Audio Control Panel again?

  • MOTOBLUR-Facebook will not add.

    Whenever I try to add my Facebook account to Motoblur it says "An internal server error has occurred. Please try again. » I tried to install this feature for three days now, always an error message.I've added twitter and my email without any problem.

  • LaserJet 1020 driver for Windows 7 x 64 does not!

    Hello. I have the problem. I recently installed Windows 7 x 64, and when I tried to install the driver for my LaserJet 1020 of the site, an error appeared. First of all, when I launched the driver installation program, I have subscribed to the licens

  • XP printing problem

    We have an application that is no longer prints after the migration of Novell iPrint for Microsoft Printing and becomes a "Set DeviceName failed (5707)" error every time we try to print.  One of them that we found is to remove the printer and reinsta

  • Error 1719 Windows Installer while trtying to install network programs?

    while trying to install a network installation, I get an error: Error 1719 of windows installation are not available.