11-20-2012 04:11 PM
I am having a lot of difficulty understanding why my readings of AIChannels using a USB-6259 are always shifted by one sample?
I tested this in the NI sample "MultiFunctionSyncAIAO.2010.cs" and found the same results, which ruled out my code as the culprit.
I modified the sample to produce a sine wave with a quarter of a wavelength to further demonstrate the problem.
In the attached image you can clearly see that the first data sample is actually the voltage reading of the last voltage sample.
For example:
Reading one equals 0.998464838304517, then reading two equals 0.000258288538461263 (which should be reading one).
The last reading equals 0.993311145261412 (which should be the second to last reading).
I cannot see how I am doing something wrong here because this is the official example code which clearly shows a major problem.
Is it my hardware, is this a driver bug?
FYI: I noticed that when I ReadMultiData only the first data set is shifted, all the other data sets are fine.
If I use "Dev1\ai0:1" all of the data in double[0,n] are shifted by one and all of the data in double[1,n] are NOT shifted.
If I use "Dev1\ai1:0" all of the data in double[0,n] are shifted by one and all of the data in double[1,n] are NOT shifted.
This proves it is not the channel that is causing this problem, it is always the first entry in single data or multi data that causes the problem.
Thanks for any help!
11-21-2012 03:09 PM
Hi Henryz,
I have recreated the issue using the example you provided, and I see the expected output. Can you please post your modified version of the code so we can test and debug the issue further?
Thanks and happy Thanksgiving!