LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Write - Append samples to buffer

I'm developing a program to play back a waveform from a large file on disk. This is 72 hours of 1kHz data on 4 channels. I can't load the entire waveform into memory, so I wanted to feed the DAQ task 1 minute at a time. I figured that I would read in a minute of file data, convert it to a waveform, and then write it to the DAQ task. While that one minute is being sent out, I can read in the next minute and convert it and have it ready to load into the DAQ task.

 

The problem is that the DAQmx Write function has two "Relative To"  options, "First Sample" and "Current Sample". Given my idea above, I'd expect that there would be a "Last Sample" option as well so I could just tack on the next block of data to the end of the currently playing sample.

 

I need to avoid any glitching on the line. I'm not sure if a simple write in a loop will be fast enough to copy the new data to the DAQ buffer. I don't have my hardware yet, but I'd like to have the basics of my application set up so I can plug in the hardware on the day it gets here. But I don't want any nasty suprises that would cause me to completely restructure my software.

 

Are there any other functions that I could look at in order to accomplish my goal?

--

Brian Rose
0 Kudos
Message 1 of 2
(4,126 Views)

Hi Brian,

 

I am not sure what devices you are using, version of DAQmx and LabVIEW you are using but I have some ideas that hopefully will help you out.  First off, I wanted to reference you to an example in the NI Example Finder that I was using for testing.  The example is called "Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi" and can be found by Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage.  This example is what you should base your code off of because it continually writes samples to the buffer every iteration.  Make sure though to set the "Relative To" DAQmx write vi to "current write position".  This needs to be added when you are setting up the generation in the DAQmx write property node.  This setting will write the data to the end of the buffer and not overwrite your waveform.  Also, you will need to change your waveform you are writing to the DAQmx Write vi to the waveform you are reading from the file.  It sounds though that you already have this portion set up.   

 

 

Regards,
Jordan F
National Instruments
0 Kudos
Message 2 of 2
(4,082 Views)