From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Acquisiton

Hi, I am trying to do build a labview program that records 16 AI channels when a button is pressed and stops when it is pressed again. I would like to do this for possible minutes (not a real fast rate - 20Hz). What I am finding is stops recording after a while and gives an error is there a way round this?
 
When it is not recording I want to be able to save the file and what I find is if I press save and then cancel which is what every user will do once in a while, when I press acquire data again an error pops up saying
 
Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan NSamp).vi:4
 
I am just doing this badly, I am including my labview program (DAQ_EXAMPLE) and the modified DAQ Assistant (tried to include input buffer control but no difference). I would also like to have a button that clears the data but haven't got a bloody clue how to solve this
 
Apart from that I am doing lovely Smiley Very Happy
 
nice

Message Edited by mr_nice on 06-03-2006 05:33 AM

Message Edited by mr_nice on 06-03-2006 05:34 AM

Download All
0 Kudos
Message 1 of 6
(2,908 Views)
Hi Mr_Nice,
 
Thank you for posting on the NI Forums.
 
I have taken a look at your code and have tested your VI. The VI seems ok, but I see the same error as yourself.
Although your VI itself will function fine, I think the issue resides with the DAQ timing settings you have specified. The default settings in your VI are buffer size=100, rate=1000, and number of samples=100. Using these settings means I receive error -200279 after a few seconds. You noted you were wishing to acquire at 20kS/s, using this sample rate the error occurred almost immediately.
 
Although I may be using settings slightly different to your own, it is these values that will govern whether you see this error. Error -200279 means the DAQ card is filling its buffer more quickly than your code can empty it. This means that after a time the new datapoints generated will be written over old data points, meaning you will lose data. This is known as a buffer overflow/overwite.
 
The buffer size setting specifies how many datapoints (per channel) your system can store in the buffer. Rate specifies the rate at which your card will sample and push a datapoint into the buffer (again, this is per channel). Number of samples relates to how many datapoints the DAQmx Read VI will pull out of the buffer on each iteration of your code (yet again, this is on a number of samples per channel basis).
 
The first step to rectify your issue is to ensure that your buffer is large enough to store intermediary datapoints while your VI iterates. For an acquisition rate of 20k I have set this buffer to be 10000 samples per channel.
 
The second step is to ensure that the datapoints are being read as quickly as they are generated by increasing the 'number of samples' setting. If you think it, any VI will have a maximum speed of iteration (dependant on the PC it is running on). If you were to pull only 1 sample on every iteration of your VI you will most likely find that you are not removing enough datapoints quickly enough and see an error (-200279). However, if you increase the number of datapoints you will find that you will increase the rate at which datapoints are being removed. For an acquisition of 20k I have set this value to 5000.
 
It is worth noting that the more you do in your code (e..g writing to file(s)), the slower it will iterate. This will mean you will have to increase the number of samples to read from the buffer to avoid a buffer overflow.
 
By using the settings I have noted I found your code runs fine and without error. I have attached your VI, but have modified the default values to the above. Please give this a go and let me know how you get along.
Thanks,
 
Rob
National Instruments | Northern California
0 Kudos
Message 2 of 6
(2,853 Views)

As a note, there is probably a method that can be invoked on the chart indicator to clear your data. I will take a quick look at this and post some example code if I find a way to do this. Cheers,

Rob

National Instruments | Northern California
0 Kudos
Message 3 of 6
(2,852 Views)

Hi again,

I have found a knowledge base (KB) that describes a solution to what you are looking for. There is no 'clear chart' method available, but you can push an empty array of data to the chart in order to clear it. Please have a read of the KB (link below), it should help clarify things for you.

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3F0BD56A4E034080020E74861&p_...

I have also generated a small piece of code to help you see what you would need to implement. I hope this helps. Thanks,

Rob

National Instruments | Northern California
0 Kudos
Message 4 of 6
(2,851 Views)

Thanks RobS,

I have included the clear history in my code I have also found a method of continous acquisiton (vi included) by not using the DAQ Assistant (that express vi is more trouble than its worth)

How I getting around storing the data is by creating a file and appending it during the acquire. This is a horrid method and would be nice to get around this by using an array. The problem I am facing is that it is in waveform format and I can't manipulate it like I can a normal array, anybody any clues how I can strip the timing and actual waveforms of the 16AI's in to a couple of arrays so that when I stop acquiring I have a couple of arrays with all the data from the 16 channels and all the timing info

The other issues I have remaining which again have stumped me is that I use the express vi read from measurment file and what it seems to do is load the file, flash the data up over a split second and then dump it again. How can I load it in to a waveform and keep the data there?

Another puzzler is that sometimes when I press record data the dialog box pops up a couple of times and the sends an error out of the move.vi

I suppose it does mean with all your help we are starting to come up with a nice generic continuous acquisiton data recorder, with file save and file display functionality

nice 

0 Kudos
Message 5 of 6
(2,841 Views)
Ok here is my new code and it is starting to work OK.
 
Have got rid of the horrible file method of storing ponts I am now ripping the individual waveforms out and storing them in one big array. Also started to save and load wavforms OK.
 
My problem is still that when I press save or load I get that bloody dialog box up twice. Has anyone seen anything like this before? Done a search and no joy
 
nice
 
 

Message Edited by mr_nice on 06-07-2006 09:07 AM

Message Edited by mr_nice on 06-07-2006 09:08 AM

0 Kudos
Message 6 of 6
(2,801 Views)