07-24-2007 01:36 PM
07-25-2007 05:54 PM - edited 07-25-2007 05:54 PM
Hi Bei,
What hardware are you using?
The DAQ card has 2 clocks – a samples clock and convert clock. The convert clock is how fast the multiplexer will run each time the sample clock ‘clocks’ in a value. The acquisition will take 1 second (1024 samples / 1024 samples/s ) because this convert clock will run through all lines each time the sample clock ‘clocks’.
For your second question, I believe the entire loop will
take 18 seconds if your ‘time to wait’ is 10. If your code takes 8 seconds
without a wait (or ‘time to wait’ = 0 ) – this sounds like a long time for what
you are doing, than this is the minimum execution time your code will take to
run. Adding a ‘wait(ms)’ timer with a value of 10,000 in its own frame of a
flat sequence will add 10 seconds to the time, forcing the entire code
execution to take 18 seconds. See picture below for an example of how you can
determine how long your code takes to run. It takes the current time (in ticks) and subrtracts the previous time from it, resulting in the amount of time the code took to run.
Please also be careful of how you code, as currently you have the DAQ setup to do finite samples, but are continuously reading – this will throw an error and must be changed to either read once or do a continuous acquisition.
Message Edited by David L. on 07-25-2007 05:55 PM
07-25-2007 06:21 PM - edited 07-25-2007 06:21 PM
Message Edited by Qifu on 07-25-2007 06:28 PM
07-25-2007 07:36 PM - edited 07-25-2007 07:36 PM
Bei,
At a glance, the code looks much better. One note – when doing continuous acquisition, the card is continually acquiring and filling up the buffer. Just because we read every 2 seconds does not mean that the card only does an acquisition every 2 seconds. Because of this, depending on the sample rate, you will eventually get a buffer overflow because the card will be filling up the buffer faster than we are reading samples out of it.
For your application, since timing is not a big concern, the easiest way to accomplish what you would like is to bring all of the DAQmx code inside the while loop or create a DAQ assistant to perform the same functionality and eliminate the low level DAQms VI’s. This will start, acquire, and stop the task each iteration of the while loop, therefore only taking 1024 samples and then waiting n seconds before doing it over again.
Message Edited by David L. on 07-25-2007 07:37 PM
07-25-2007 07:46 PM
07-25-2007 07:59 PM
07-25-2007 08:01 PM
07-27-2007 05:42 PM
No. If we do not start, read, and stop the task inside the while loop, only having the DAQmx read inside the while loop will give us ‘old’ data. This is because the data will continue to be acquired from the beginning, but you are only reading it every two seconds. The buffer will hold the old data until it is read out.