LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you use multiple DAQmx task in one .net DLL?

Solved!
Go to solution

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.

0 Kudos
Message 1 of 9
(2,689 Views)

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.

0 Kudos
Message 2 of 9
(2,666 Views)

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 9
(2,663 Views)

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.

0 Kudos
Message 4 of 9
(2,657 Views)

"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.

 

0 Kudos
Message 5 of 9
(2,635 Views)

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. Code to DLL.png

0 Kudos
Message 6 of 9
(2,618 Views)
Solution
Accepted by topic author Chi55

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). 

0 Kudos
Message 7 of 9
(2,610 Views)

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

0 Kudos
Message 8 of 9
(2,606 Views)

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.

Message 9 of 9
(2,600 Views)