From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-04-2016 08:08 AM
Hi everyone,
I am developing an application in LabVIEW 2015 (version 15.0f2 32bit) to control servo drive for a linear motors from the company LinMot. More information over the servo drive can be found on the following link: http://shop.linmot.com/E/ag7000.b11/drives-for-motors-p01-&-pr01/series-b1100/b1100-gp-hc.htm. The connection between my LabVIEW software and the servodrive is over the CANopen standard, and I use the module NI USB-8473s to establish the communication between my PC and the drive.
All develped software works very well when I execute it in the LabVIEW environment. But then I would like to create a DLL file with all control functions, so the end customer can use my software in his Visual Studio C++ program. The application build and the linking of the DLL in Visual Studio works fine, and most of the functions could be used without problem. But in one of the functions is used an endless loop in a timed loop, that needs to execute all the commandos in a sequence with endless repetition until another command is asked to cancel it execution. When this function is executed in the C++ code I can see that the hardware is getting the right commandos, but the software is crushing completely. I was suggested to create something in LabVIEW that would be similar to the Application::DoEvents method in Visual Studio, and from my knowledge I add a timer into the loop with 0 milliseconds connected, so I can release the resources at the end of the loop. But still I am getting the same behaviour.
Could anyone please give me some suggestion what I should consider in order to solve the problem?
Thank you very much in advance.
Kind Regards,
Nikola Todorovski
07-05-2016 03:16 AM
Hi Nikola,
is there a reason, why you use a timed loop for the enless task? Since you are running the code in a DLL on Windows, this may have an influence on the behavior. Could you try it out with a while loop and a timimg inside the loop?
Best regards,
Melanie Eisfeld
Staff Applications Engineer
National Instruments
07-06-2016 07:04 AM
Hi Melanie,
thank you very much for your reply.
I am using the timed loop in roder to control the execution of the code in a secure manner. But I just changed the timed loop with a while loop and still the program is crushing. Attached to my post you can see the VI from which I create the DLL. This function is actually crushing the program.
I would be very thankful if you give me some tips and ideas how to solve the problem. Please let me know if you need the full code.
Thank you very mich in advance.
Kind Regards,
Nikola
07-06-2016 07:10 AM
07-06-2016 07:10 AM
Hi Nikola,
The complete code would be very helpfull, as well as, the line that calls the code from c++.
My suggestion is, that maybe some parameter is passed the wrong way or something like that. To analyze this, the call and the VI could help me.
Best regards,
Melanie
07-07-2016 01:48 AM
Hi Melanie,
I was working on my code and I figure it out that the main problem for me is to stop the while loop in C. So basically if I have a while loop which loops until state of some variable is changed, how can I change the state of that variable in C? So maybe I need more information about working with pointers in LabVIEW? Any help on this issue?
Kind Regards,
Nikola
07-07-2016 01:53 AM
Hi Mike,
thank you very much for your reply. I can't understand you what you mean about working with .NET components. My knowledge is very poor in that field. Can you please give me some more infos or some examples?
Thank you very much.
Kind Regards,
Nikola
07-07-2016 05:18 AM
Hi Nikola,
this is a general question that is not related specially to LabVIEW.
The general process that works for nearly every application architechture like you have is the following:
I hope this helps you getting started with it. I'd recomment reading about general DLL and calling application challenges.
Best regards,
Melanie
07-07-2016 05:42 AM