LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling - DAQ assistant

Here is what I want: I want to measure (sample) som data (voltage) from a input module using the NI cDAQ. Then munipulate with the data (control)
This is how I have done it: I´m using "continous sampling" 200 hz with a buffer size of 20 (using the daq assistant) - This I have placed inside a timed loop (5 ms)
My problem: Some times I experience an error: "attempting to read some data that no longer exist" - But if I increase the buffer the loop becomes sloooow! Its like the DAQ assistant then fills up the buffer at each iteration??? how can I just read one sample at each iteration of the timed loop and then just have the buffer as an precausion?
 
hope someone can help me
0 Kudos
Message 1 of 4
(2,736 Views)
You said how you configured the task and the buffer, but you did not say how many points out of the buffer you are currently reading for each iteration.  Normally, that error will show up when you are sampling faster than you are reading.  You see how if you take 200 samples per second, and read out less than that rate, eventually you will end up with a full buffer.  If that happens, you lose a piece of data (it get replaced by new data).  Then, when your read VI goes looking for it, it spits out that error.

The trick here will be to read them faster or sample them slower.  Is there a reason why they need to come out one at a time?  Is there any significance to the 5 ms loop rate (other than it is exactly the period of a 200hz frequency)?  You have a bunch of options, your application will determine which path you take.

Best of luck,
~milq
Message 2 of 4
(2,734 Views)
Thanks for you reply........ How can I choose how many samples to read each iteration? As I can see it I now read the hole buffer!?.... My only needs is that I need some data for a control loop, and I just dont want an error 🙂
0 Kudos
Message 3 of 4
(2,725 Views)
Attaching your code makes it easy for us to show you.

It sounds like there might be something else hiding in there that is causing an issue.

~milq
Message 4 of 4
(2,713 Views)