Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to overwrite the output buffer?

Solved!
Go to solution

I'm doing a 2-channel finite signal generation on a0 and a1. I want to change one or other of the waveforms at various times during the program, and sometimes I need to be able to overwrite the contents of the buffer with a new set of data before the generation has run. Should be really easy but so far I haven't figured out how to do it.

When I try, on the first attempt to overwrite the buffer I get Error -200547 occurred at DAQmx Write (Analog 2D DBL NChan NSamp).vi which says the buffer's full, can't write more data until the task has been run.

 

How do I clear the buffer contents or make it possible to overwrite the buffer?

 

0 Kudos
Message 1 of 6
(4,151 Views)

Hey CDancer

 

Any chance you can post your code to see how your writing your signals currently?

Matthew Trott
Applications Engineer
National Instruments UK
www.ni.com/ask
0 Kudos
Message 2 of 6
(4,128 Views)

Hi Matthew,

 

Here it is stripped down to its bare bones. I know it looks a bit silly like this but it makes sense when it's in the program. What I'm trying to do is change the data for each channel independenly at different times. So what I'm looking for is something put between the two writes that either cancels / resets the waveform output operation, or just allows me to overwrite the data in the buffer.

 

Chris

 

 

Download All
0 Kudos
Message 3 of 6
(4,124 Views)

Hi

 

I would suggest the following community example may help:

 

Multi-Channel Finite Generation with Different Durations Across Channels

 

 

Kind regards,

Daniel T
Account Manager
National Instruments UK & Ireland
0 Kudos
Message 4 of 6
(4,088 Views)

Thanks, Daniel.

 

That doesn't help because both waveforms are still being written to the buffer together in a 2-D array. I want to write each waveform individually to the buffer.

 

I could use a 2D array or 2x 1D arrays as holding stores for the waveforms until the time comes to start the generation, at which point I would write them to the buffer and start the generation. I don't like this method though because this is a time-critical application. I want the data in the buffer ready to go when a trigger pulse or keypress is received, I don't want to be faffing about shunting data around.

 

Chris

 

0 Kudos
Message 5 of 6
(4,084 Views)
Solution
Accepted by topic author CDancer

I found the solution, by systematically going through the DAQmx palette looking for likely functions.

 

Simply insert a DAQmx Control Task.vi before the DAQmx write.vi, with Action set to unreserve. You can then write new data to the buffer.

I knew it had to be possible!

 

0 Kudos
Message 6 of 6
(4,063 Views)