From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Wait Until Done" doesn't stop waiting although data generation is already done.

Solved!
Go to solution

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:

 

daq_generation.png

 

Does anyone have any idea about what's wrong here? (SubVI's are also attached)

 

Cheers,

 

Palazzo

Download All
0 Kudos
Message 1 of 5
(4,298 Views)

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

0 Kudos
Message 2 of 5
(4,266 Views)

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 Smiley Sad

 

Cheers,

 

Palazzo

 

0 Kudos
Message 3 of 5
(4,218 Views)

Hi Palazzo,

 

Here's an article that may be of use to you: http://digital.ni.com/public.nsf/allkb/BFCE83133C0ECAD786256E6000814B68

 

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:

http://zone.ni.com/reference/en-XX/help/370466AC-01/mxcncpts/taskstatemodel


A good example of DAQmx flow can be found here as well: http://www.ni.com/product-documentation/2835/en/

Sunayna R.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(4,191 Views)
Solution
Accepted by topic author Palazzo

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

0 Kudos
Message 5 of 5
(4,167 Views)