Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB-6218 sample rate inconsistent?

So instead of getting one sample per loop, go for 5 or 10? Or more? I can see how that might help...

0 Kudos
Message 11 of 21
(2,338 Views)
Something like 10% might be more reasonable. For example, 1000 samples/sec and 100 samples.
0 Kudos
Message 12 of 21
(2,335 Views)

I'm not sure if I understand... Can you give me pseudocode? That would be awesome.

0 Kudos
Message 13 of 21
(2,332 Views)
Have you looked at the getdata function I mentioned and the samples parameter?
0 Kudos
Message 14 of 21
(2,327 Views)

Yes, I did. Basically, it doesn't really fit my purpose. Because I need to graph the data in real time. So someone can watch it. Maybe it won't make a difference if I grab just a few, but yeah...

0 Kudos
Message 15 of 21
(2,321 Views)
You don't think getting data every 100ms is fast enough? What sort of refresh rate is on your computer monitor or on your tv?
0 Kudos
Message 16 of 21
(2,318 Views)
Sorry, meant to finish it saying you can adjust rate to whatever you want but you need understand that displaying fewer samples will mean displaying less of s complete waveform.
0 Kudos
Message 17 of 21
(2,314 Views)

It's possible that I could. I'll have to talk to my supervisor.

 

I'm trying it out right now though.

 

I use getdata(ai, 50) and give it a 100 ms pause every loop.

 

After a few iterations, it says

 

"Error using daq.analoginput_nidaqmx_1_22/getdata

     OBJ is not running and no data is available. Use START before calling GETDATA

 

Error in analoginput/getdata

     varargout(1) = getdata(uddobj, samples,dataformat); "

 

I started ai outside of the loop, and the first few iterations it doesn't have any problems. So I have no idea what's going on now...

 

 

0 Kudos
Message 18 of 21
(2,299 Views)

Just checked, I can't use the getdata(). I have to get single values and send them off. Not totally sure why.

 

So is there anything that could cause the slow down? My code is just "get a value, wait, repeat." I have no idea why that wouldn't work.

0 Kudos
Message 19 of 21
(2,296 Views)
First, I don't see a wait in the for loop of your original code. Second, as I mentioned, you are using software timed input. On a non-real-time os, the timing resolution can vary widely. That was the whole point of the recommendation to change to hardware timed input where the sample rate is meaningful.
0 Kudos
Message 20 of 21
(2,281 Views)