04-23-2012 07:40 AM
Hi, I am working in data acquisition of data translation dt9816. My problem is how to get the sample index?
I need the sample index for time stamp count from 0:
the calculation of time stamp is t_sample= t0 + i / sample rate ( where i = sample index)
I also attach my block diagram.
Best regards, citra
04-23-2012 10:00 AM
I will rephrase: Do you need the number of samples already read before current iteration?
If you do not fix the number of samples read each time, you can calculate it, using array size, then add via shift registers
Several notes:
1) Your timing is set in hardware (via sample rate), and you use software timing functions to record time - use time calculations from index, according to your formula.
2) You read multiple samples (2D array supposes that), and add only 1 time point - you need to make an array of times.
3) As I suppose, the channels should be in columns, and time increase - in rows. So, when you add time points for samples, you should add column to the array - 2 transposes.
4) Your rate is rather high, besides you write strings, and you reopen file on each iteration. it is better to use streaming (open file before the loop, close after).
5) Do not you lose data when converting from double to decimal string?