10-13-2011 05:56 AM
Hi,
I have labview2010 and Ni-USB-6009. i am trying to write data coming through Ni-USB009 on a text file.
everything is Ok except the sampling rate. i set rate to 10K but when i check on text file it only gives me 50 to 60 readings per second but it should be 10K/second.any idea how to improve that? code is attached
10-13-2011 06:53 AM
I do not have NI-DAQ on my machine. But you do now that for your DAQ card the sample rate is aggregate. That is the same as all the channels must share the sample rate. So for 1 channel you can have max 10 KHz sample rate for 2 channels 5 KHz, and so on
10-13-2011 06:56 AM
yes i know that. NI-USB-6009 has 48KS/s and i am taking 10K for each channel and i am using 3 channels. but still when i saw the ouput text file it only gives be 60 values per second. am i making any mistake?
10-13-2011 07:32 AM
I see the mistake now. Your loop is spinning as fast as it can and that is about 60 times pr second. And every time you read your DAQ unit. You read all samples that are in buffer. But you take a single value from this group and store it. Labview running in Windows/Mac/Linux is not a realtime system. So you can not read one sample each time at 10 KHz speed. But you can read a group of samples say with a rate of 10 Hz. In your case that will 1000 samples pr channel each time. Also check out these functions. You should also know that the Get Time/Date string function use the system clock. And that is only updated with limited speed around 50 Hz I think.
Array To Spreadsheet String Function
Owning Palette: String Functions
Converts an array of any dimension to a table in string form, containing tabs separating column elements, a platform-dependent EOL character separating rows, and, for arrays of three or more dimensions, headers separating pages.
Spreadsheet String To Array Function
Owning Palette: String Functions
Converts the spreadsheet string to an array of the dimension and representation of array type. This function works for arrays of strings and arrays of numbers.
10-13-2011 08:17 AM
so you mean i can set my sampling rate to 10 Hz and then read 1000 samples each time?
thanks for the suggestion to use "Array To Spreadsheet String Function ".
10-13-2011 08:44 AM - edited 10-13-2011 08:45 AM
@Hussain01 wrote:
so you mean i can set my sampling rate to 10 Hz and then read 1000 samples each time?
thanks for the suggestion to use "Array To Spreadsheet String Function ".
No not quite. Take a look at this example note the sample rate, and samples to read controll functions