08-25-2011 05:17 AM
Hi all,
We are runing LabVIEW 8.51 in the lab and have been using a bodged together C++ DLL which was crude but got the job done. Now looking at rewriting it in C# to make it easier to maintain and support long term.
Ive got the C# DLL appearing in Labview and can happily call my test functions from the VI to prove both the DLL inputs and outputs are working fine (the simple input a number, add 1 and return result type of code).
However, this DLL will end up managing a Serial port connection so the contstructor must only be called once as its responsible for making my .net serial port object. Ive added a text log message in the constructor and have found that just running the VI is causing the constructor to be called at least 5 times a second. There is no user input causing this....just running the VI.
Both VI and C# source is attached.
Any ideas folks? Im a complete newbie at LabVIEW having taken this on from another developer.
The VI is in \Release and this is where the Log file is generated.
Mat
08-25-2011 08:21 AM
Well, I may not be Sherlock Holmes, but I think the fact that you have your constructor inside the loop is probably a pretty good clue as to why your constructor is being called all the time.
08-25-2011 08:34 AM
As I said, im a total LabView newbie......loop?
08-25-2011 08:53 AM
Ummmm.. yes, loop. That big thing gray rectangle that surrounds your code. Have you done any LabVIEW tutorials? That isn't even a LabVIEW question, but a basic programming question.
To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.
08-25-2011 08:57 AM
As I said in the intro, Ive taken on maintance of the code from another developer who has left the company. So havent a clue about LabVIEW and am learning it as I go.
So yeah...moved outside box and everything is good. Thanks for your help!