Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 6341 buffer problem

Solved!
Go to solution

We have a NI USB 6341 DAQ. I want to output an analog sawtooth waveform by external triggers. In other words, there will be a sawtooth signal generated every 480 input pulses. The frequency of the trigger is 5k Hz, therefore, the generated sawtooth signal is around 10Hz.

 

But I keep on getting error codes about buffers. This time, the error message is:

 

Error -201025 occurred at DAQmx Start Task.vi:7220001

Possible reason(s):

Non-buffered hardware-timed operations are not supported for this device and Channel Type.

Set the Buffer Size to greater than 0, do not configure Sample Clock timing, or set Sample Timing Type to On Demand.

Task Name: _unnamedTask<856>

Source:

DAQmx Start Task.vi:7220001<append>
<B>Task Name: </B>_unnamedTask<856>

 

Can anybody help me with the code attached?

 

Thanks!

0 Kudos
Message 1 of 7
(6,540 Views)

carless,

 

I don't yet have LV 2013 installed, so I can't view your VI.  Typically when this error occurs, it's because you did not call DAQmx Write before you start your task.  For buffered tasks, this initial call to write will also set your buffer size (unless you explicitly set your buffer size VI DAQmx's Configure Output Buffer VI or buffer property node).  Without one of these actions, DAQmx will see the buffer size as zero when your task is started, and you'll see the error you received.

 

Hope that helps,

Dan

0 Kudos
Message 2 of 7
(6,520 Views)

Thank you for your reply!

 

I tried putting the "Start" after "Write", but I got another error message:

 

Error -200288 occurred at sawtooth_generation2.vi

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: 1000
Property: RelativeTo
Corresponding Value: Current Write Position
Property: Offset
Corresponding Value: 0

Task Name: _unnamedTask<C>

 

I attach a LV2010 version VI as well as a screenshot here. Please take a look.

 

Thank you very much!

Download All
0 Kudos
Message 3 of 7
(6,509 Views)
Solution
Accepted by topic author carless

This problem is occuring because the DAQmx Start VI is executing every loop. This restarts the task over before it can finish outputting the last data set. In most applications you will start the task once and let it go until it is finished. Some applications require starting and stopping periodically, so you should use the DAQmx Stop Task before using the Start VI again.

 

I think that there is a fundamentally better way to create your application. If I understand this right, you want to output one sample of the sawtooth wave for every pulse of the "external trigger". Is that right? If that is the case then what you really want is to use an external sample clock on the DAQmx Timing VI. This is similar to the way that this example is set up: https://decibel.ni.com/content/docs/DOC-11195

 

Also, I believe that what you are trying to do is to repeat the same output samples over and over. If that is the case, then you want to use a property node to regenerate the samples. In other words, you just need to send one sawtooth waveform with 480 samples and the DAQ device will repeat these samples over and over until you stop the task: http://digital.ni.com/public.nsf/allkb/DD750D84BAD703E386256E6E005B41AC

 

Jeremy P.

 

 

 

 

Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(6,501 Views)

carless,

 

In the case where the task is done, you need to stop the task before writing new samples and restarting it.  The error you are seeing is basically DAQmx trying to tell you that since the task is done, the data written will never get output.

 

What are you trying to output here?  You have a sawtooth pattern that is composed of 1000 points (10 cycles).  You've set up a finite generation of 480 samples, when each generation ends, you'll have output about half of the waveform you've generated.  You then do this 480 times?  Each time the task stops and re-starts, you're going to have a discontinuity in this waveform (the time it takes DAQmx to stop, write data, and restart).  I suspect this is not the behavior you're aiming for.  If you can give me more details about what you'd like to output, perhaps I can point you in the right direction.

 

Dan

0 Kudos
Message 5 of 7
(6,484 Views)

Hi Jeremy,

 

Thank you very much for the help! Problem solved!

 

0 Kudos
Message 6 of 7
(6,473 Views)

Thank you very much for the help! Your suggestion is very helpful!

 

The problem is now solved!

0 Kudos
Message 7 of 7
(6,472 Views)