03-21-2016 05:47 PM
Hello all,
I have a code both for generating and acquiring data with samples rates around 50kHz. I have pre-determined data length, so I use finite-sample-generation. I also use Wait Until Done to make sure my task is done properly. When I simultaneously measure my generated data, I see that Wait Until Done is not stopping although all of my signal is already generated. And also I get -200560 error (timeout for wait until done function)
Please see the data generation loop below:
Does anyone have any idea about what's wrong here? (SubVI's are also attached)
Cheers,
Palazzo
Solved! Go to Solution.
03-21-2016 08:05 PM - edited 03-21-2016 08:10 PM
I don't know if this will make a difference but I would try using the DAQmx Stop Task.vi immediatly after DAQmx Wait Until done.vi to explicitly stop the task. Doess the timeout happen on the first iteration of the state machine?
edit: In the outdaq_task subVI set DAQmx Write property to Do not allow regeneration.
Ben64
03-22-2016 10:13 AM - edited 03-22-2016 10:14 AM
Hello Ben,
It is not working, tried couple of times, in different sections of the code. The problem is, current state stucks in "Generate Data" since Wait Until Done keeps the task waiting.
BUT, I noticed that Wait Until Done is not the cause of the problem. DAQmx Write attemps to write the data twice! My waveform length is 8000 samples, this is the # of samples that I defined to "Sample Clock" as well. But when I delete Wait Until done function, I get error -200288:
Error -200288 occurred at DAQmx Write
Possible reason(s):
Attempted to write a sample beyond the final sample generated. The generation has stopped, therefore the sample specified by the combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not beyond, the final sample generated. The final sample generated can be determined by querying the total samples generated after a generation has stopped.
Attempted to Write Sample: 16000
Property: RelativeTo
Corresponding Value: Current Write Position
Property: Offset
Corresponding Value: 0
Why is this happening? Makes no sense
Cheers,
Palazzo
03-22-2016
06:18 PM
- last edited on
12-03-2024
11:19 AM
by
Content Cleaner
Hi Palazzo,
Here's an article that may be of use to you: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9KaSAK&l=en-US
As the previous commenter mentioned, stopping the task is always important to ensure that all resources are deallocated from the task. Make sure to follow the DAQmx Task State Model, described here:
https://www.ni.com/docs/en-US/bundle/ni-daqmx/page/taskstatemodel.html
A good example of DAQmx flow can be found here as well: https://www.ni.com/en/support/documentation/supplemental/06/learn-10-functions-in-ni-daqmx-and-handl...
03-23-2016 02:32 AM
Hello Sunayna,
Thanks for the reply, I've been through these documents in the past so many times.
BUT, eventually found the reason: "the error is always the simplest one". I have 4 loops running in parallel, it turned out that my stop command is not reaching generation loop in time so that state machine executes data generation again.
Thanks for the replies so far.
Palazzo