LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset buffer pointer for analog output generation?

I am doing a finite analog output generation on a USB-6216

 

Sequence of events:

 

DAQmx Create Task

DAQmx Timing (finite samples, 1000Hz)

Use DAQmx timing property SampQuant:Samples per channel to set buffer size

Write buffer with DAQmx Write

Repeat

  DAQmx Start Task

  DAQmx Wait until done

  DAQmx Stop Task

Until finished

DAQmx Clear Task

 

I get a full waveform output on the first iteration of the loop. On subsequent iterations I get only a small section of the waveform, but no error. It seems that it is regenerating the waveform, because when I switch off regeneration I get an error at Start Task, but before it can regenerate all the data Wait Until Done.vi decides that the generation is done and exits, stopping the generation.

I have done this with a PCI device and it works fine; every call to Start Task generates the whole waveform again.

 

OK, so it looks like after every waveform generation completes I need to reset the pointer to the start of the buffer, so that the Wait Until Done vi does not think the generation is done. Or - maybe there is a way to reset the "Generation Done" state?

 

I'm sure there's an easy way to do this....?

 

0 Kudos
Message 1 of 4
(3,617 Views)

Aditional info:

 

This is strange... the Task Done property is True immediately after calling DAQmx Create Task, before I have done the output generation or even written data to the buffer! It remains True. It never goes False, even after calling DAQmx Stop Task.

 

 

0 Kudos
Message 2 of 4
(3,608 Views)

Hi CDancer,

 

Many thanks for contacting National Instruments. If I can start by giving some general advice, it would be well worth posting your actual VI. This helps others on this forum in helping you with your application. 

 

From the sounds of things, you want to do continuous analog output generation. I have had a look at the examples that come with LabVIEW and I think you should look at the one below.

 

I would have a look at some of the DAQmx examples that come installed with LabVIEW. The following example would be particularly relevant I feel

 

Cont  Gen Voltage Wfm-Int Clk-non Regeneration.vi 

 

Please let me know how you get on.

 

Many thanks,

Andrew McLennan
Applications Engineer
National Instruments
0 Kudos
Message 3 of 4
(3,563 Views)

Thanks Andrew,

 

I solved the problem. I was working in Labview 7.1 with an old version of DAQmx which did not support the USB device, although it worked partially. I installed an up-to-date version of DAQmx and it worked fully.

 

I didn't want to do continuous analog output generation. It is a finite, repeatable output generation with the option of re-writing the buffer with a different waveform between runs.

 

Chris

 

0 Kudos
Message 4 of 4
(3,548 Views)