LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Explanation for Pause a task

Solved!
Go to solution

Hello guys,

 

ich have a little problem to understand what happens when I pause a task.

 

A little explanation to my program:

I generate a signal over time. That means I give the program the amplitude, the frequency and the time how longe the signal should run (example 10 min).

So to have a better calculation time I do the following. First I generate the first pattern und write it in the buffer (defined amount of samples). Then I start the task.

So now the samples gets transfered from the buffer to the device. I have written a callback function (int32 CVICALLBACK OnEveryNSamplesEvent (TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)) that generates the next pattern when the first defined amount of samples are transferred to the device. This has the advantage that I must not calculate a very big array at the start of the program instead I calculate every time a part of it parallel when the buffer writes to the device.

 

So and now to my question.
I do not know what happens when I break the task (DAQmxStopTask (taskHandle);)
I tried it and it has the function I would like to have but is there the danger that my buffer can have an overflow? Does the whole program also the calculation in the background stand still when I break the task?

(My theory is that with DAQmxStartTask(taskHandle) I begin to transfer the samples from the buffer into the device. When I stop the task it doesn't transfer the samples anymore and so the calcualtion in the background stands also still)

 

Hope somebody can give me the correct solution to the problem.

 

Best Regards

0 Kudos
Message 1 of 2
(3,025 Views)
Solution
Accepted by topic author Fasching_K

Hello Fasching_K,

 

What is the Difference between the DAQmx Stop Task VI and the DAQmx Clear Task VI?

 

Interesting here is

When performing analog output operations, you must write a buffer of data to the output FIFO before starting the operation. In effect, this moves the task to a state of "reserved" before calling the DAQmx Start Task VI (which moves it to "running"). When the DAQmx Stop Task VI is called, it moves the state from "running" back to "reserved", so any attempt to start the task again with different values generates an error.

 

In your case you stopped the task an wiht this you stop also writting values into the buffer so normally no overflow should happend.

best regards
Alexander
0 Kudos
Message 2 of 2
(2,957 Views)