01-08-2019 12:03 PM
I have two VIs that I am trying to create .net DLLs for. The first VI works just find, and when called in visual studios gives the correct output. For the other VI when called it always returns NaN. When the VI is ran it gives the correct output, so I know the issue isn't the VI and something with the DLL. I've tried rebuilding the DLL as well as making a new copy of the VI and trying from scratch. The VI I'm having an issue with is using three different task, while the one that is working only has one task. Not sure if that would cause the issue, I haven't been able to find much information about if there is a limit or not, and though I would ask.
Solved! Go to Solution.
01-08-2019 01:27 PM
Get the error from the VI (source and code), not just result value.
Many issues can make dll different from VI. Default starting values, something not included into build, ...
Number of tasks should not be an issue.
01-08-2019 01:43 PM
@Alexander_Sobolev wrote:
Get the error from the VI (source and code), not just result value.
Many issues can make dll different from VI. Default starting values, something not included into build, ...
Number of tasks should not be an issue.
Looking to learn here...
I was told that the dll's produced by LV are single threaded.
Not sure if that true or false so feel free to enlighten me if you know and care to do so.
Ben
01-08-2019 02:21 PM
Can you explain what you mean by get the error? Do you mean include the error cluster into the dll? Both the VI and Visual Studios code run without an error message.
01-08-2019 04:35 PM
"Visual Studios code run without an error message"
VIs have "automatic error handling" option turned on by default, so every time there is unconnected output with error, message pops up.
If error happens during dll execution, it will not display it, this property is turned off during build.
"get the error from dll" = You need extra output, indicating what error has happened and where. If it can not initialize 2-nd daqmx task, you will know the reason.
01-09-2019 07:41 AM
I go an error code -200284 from running it in visual studios. That error meaning is "Some or all of the samples requested have not yet been acquired". That makes sense with getting a NaN output, but doesn't help figure out what part is having an issue when in the dll. This is the VI I'm trying to create the dll with as well.
01-09-2019 09:20 AM
So, counter task (at least one. what about the second one?) has been created, starts waiting for trigger, but does not get a trigger.
Does digital task generate an error?
Can you add delay between switching the state of the line to set pulse width?
As a second thought, can you force digital task to generate pulse before both reads (put it into the second frame of sequence or route error cluster).
01-09-2019 09:46 AM
As a second thought, can you force digital task to generate pulse before both reads (put it into the second frame of sequence or route error cluster).
That was it! Added a new frame and moved it in and it worked. Thanks
01-09-2019 10:33 AM
It means .net DLL call is fully single threaded (as Ben mentioned).
It has internally compiled that DAQmx Reads (at least one of them) happen first. It blocks execution and does not generate digital task until Read(s) timeout. Board and low level still work in parallel - they can still accumulate data on tasks simultaneously.