LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with daqmx read and error code 200278..........

I have an SCXI-1001 Chasis with an SCXI-1600 (USB) and three SCXI-1102's. I am trying to acquire data from 9 channels, 80 samples per channel at 200hz.  The sampling mode is finite.  The first time the loop executes I get what I expect, 80 samples from 9 channels, in about .4 seconds.  The second time the loop executes I get error code 200278.  I have tried about everything I could find on this site with no success.  I have changed the sampling mode to continuous and get no error but the samples per channel available to read are usually less than 80.  I can increase the timeout but then the samples per channel available to read are more than 80.  I just want to get 80 fresh samples per channel at 200hz, sampling mode does not really matter, although I would like understand both.  I'll attach my code, any help would be appreciated......Test2.vi is the main VI, DAQmx read position was downloaded from another user in this forum.......
 
Thanks!

Message Edited by Frank Rizzo on 05-11-2006 12:16 PM

Download All
0 Kudos
Message 1 of 5
(3,030 Views)

Hi Frank,

Just as you figured out, you definitely want to set the acquisition mode to continuous in this case.  A finite acquisition acquires a predetermined number of samples, and then stops when the buffer is full.  In your case, you would acquire that specified amount, stop the acquisition, then on the next loop try to read samples that didn't exist (which throws the error you saw).  In a continuous acquisition, the board just keeps grabbing those samples until stopped by the user or another event.

I ran the code on my machine (I have different hardware, an M-series DAQ card), and for me it ran just as you had intended.  It ran continuously, and on every loop it acquired exactly 80 samples on all 9 channels.  I'm not sure how you could be getting less than 80 samples if you have the 'number of samples per channel' input of the DAQmx Read VI set to 80.  The way it works is when the VI is called inside the loop, it checks the buffer to see if 80 samples are available.  If they are, it reads that data off the buffer.  If there are less than 80 samples in the buffer, it waits until either the buffer reaches 80 samples or the specified timeout value is reached.

Could you try running it with just 1 channel to see if that behaves correctly?

Thanks,

Justin M.
National Instruments

0 Kudos
Message 2 of 5
(3,013 Views)
Thanks for the information Justin!  I did try it with one channel as you suggested and the results are as expected.  The thing that I dont understand is, how do I know that I am getting 80 fresh samples of data on every iteration?  I think the confusion lies in the DAQmx read position.vi,  when I look at the output before I call the Daqmx read.vi, the "samples available" indicator of the front panel of the DAQmx read position.vi is always showing less than 80.  I'm guessing this is just a timing thing and I would get what I input as "number of samples per channel" ?  Thanks for your help..........

Message Edited by Frank Rizzo on 05-15-2006 08:26 AM

0 Kudos
Message 3 of 5
(3,005 Views)

Hi Frank,

I took a look at the code in DAQmx read position.vi, and it looks like an output of 80 or above from the 'samples available' output should be possible.  The 'samples available' output just shows the total number of samples acquired (per channel) minus the current read position.  Here is some pseudocode of what the DAQmx read position.vi is actually doing:


Let samples to read = 80;

IF (have not read in 80 new samples from current read position) {
leave current read position alone and keep reading in values;

ELSE (if you have read in 80 or more new samples from current read position)
set a new current read position that is 80 samples behind the most recent sample acquired;


The software is checking the hardware buffer for the number of samples available.  When the VI gets called, if the DAQ card has not read in 80 new samples since the last time the current read position was set, it does nothing and waits for the next iteration of the loop.  If it reads the buffer on the next iteration and finds that there are 100 samples waiting, it sets the current read position to 20 so that the DAQmx read will grab the most recent 80 samples, and disregard the other 20.

It looks like this VI was designed for the case where the DAQ card is acquiring data faster than the software can read it out of the buffer.  If this were the case, the buffer would eventually fill up and then throw an error.  This DAQmx read position VI makes sure that when the buffer starts filling up past the number you are trying to read, you always grab the most recent samples.  For your specific case, I'm guessing that your program is reading the samples out of the buffer fast enough, so the 'samples available' output should never hit 80 or above.

That was a little tough to put down into words...let me know if any of this is unclear.

Thanks,

Justin M.
National Instruments

0 Kudos
Message 4 of 5
(2,973 Views)
Hey Justin.  Your comments have been very helpful.  Continuous sampling is not working out for me.  I have had problems with it in the past.  What has happened is the data acquisition loop is interupted by an operator who is changing parameters in the channel editor or maybe in a control loop.  The interuption causes the number of samples in the buffer to rise.  In time these small increases in the number of samples in the buffer add up and cause an overflow shutting the sampling and the test down.  What I want to use is the finite sampling method.  I have attached a VI for your review.  I found a slight problem and there doesnt seem to be much info on it. Its error code -200239, here is what is going on:
 
The Daqmx Start Task.vi would start out running quickly, taking about .04 to .06 seconds to complete.  After a number of iterations error code -200239 would show up.  On the following iterations of the loop the time the Daqmx Start Task.vi would take to execute would rise to .8 seconds.  Today its performing great.   I have  been running fine for three hours now with no errors but after what I saw yesterday I have no confidence I can use this model for one of our facilities. 
 
Thanks for your help!
0 Kudos
Message 5 of 5
(2,962 Views)