06-05-2007 01:48 PM
06-05-2007 01:50 PM
06-06-2007 04:24 AM
06-06-2007 08:03 AM
Hi,
Thanks for the reply.
I did use a physical NI USB 9233. There is no simulated device installed.
I tried WHILE loop this morning and got same problem.
If the sampling rate is one of the following: 2K, 5K and 10K Hz, then the sampling time will be 1 second. Other than those rates, the sampling time will be unpredictable.
Thanks again for the help.
06-06-2007 03:17 PM - edited 06-06-2007 03:17 PM
A few things:
Your acquisition will start as soon as you call DAQmx Start - the read just pulls X # of samples from the PC buffer whenever it is called. The total time it will take to acquire 20,000 samples at 1000 S/s is going to be 20 seconds - this does not mean that each loop iteration will take exactly 1 second. So if you find the time difference between when you call DAQmx start and when you exit the loop, your time should be close to 20 seconds (plus some start up time for DAQmx Start). Most loops will run at 1 second, but things can change this: if one loop runs longer due to extra processing or Windows being Windows, the DAQ card will continue to fill the buffer, and the next DAQmx Read will not have to take 1 second to pull from the buffer because the samples are already there. So that next loop could be less than a second. You could see this on the first loop iteration as well - since the DAQmx Start is called before the loop starts, there will be samples already in the buffer when the DAQmx Read is made.
If you want to have it less dependent on the system, you can use one of the wait functions to control the loop timing.
Hope this helps, please post back if you have additional questions.
Cheers,
Andrew S
National Instruments
Message Edited by stilly32 on 06-06-2007 03:18 PM
06-06-2007 05:24 PM - edited 06-06-2007 05:24 PM
Message Edited by Mcdan on 06-06-2007 05:25 PM
06-07-2007 07:22 AM
Thank you all for the replies.
I did not realize that NI 9233 only accept certain sampling rates like Don just pointed out. I tried for those sampling rates and all worked well. I also found out when a sampling rate that is not in the list will be automatically coerced to the next available one in the list.
Thanks again for the your help.