02-04-2016 03:41 AM
I am continuously sampling port 0 on a USB6356 and saving the data in a Raw 1D U8 array. I have set a sampling rate of 1Mhz but for some reason the number of samples in the array is about 3 times larger so there is no way I can represent the data on a time scale.
Any idea why this is happening?
Solved! Go to Solution.
02-04-2016 05:42 AM
You should start your task before the loop.
Can you share the rest of your configuration? Perhaps something is wrong in there.
02-04-2016 06:20 AM
Thanks, I have now added the Start Task VI before the loop.
here is the configuration for the task in MAX
02-04-2016 06:57 AM
I have also tried solving this problem in two different ways:
- writing the samples to a file in every iteration: in this case I get the following error:
Error -200279 occurred at DAQmx Read (Raw 1D U8).vi:5860002
Possible reason(s):
The application is not able to keep up with the hardware acquisition.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0
Task Name: USB6356_Acq_DI_port0
- creating a producer/consumer structure: the catured data is enqueued in one loop and dequeued in the other one. I get the same error as above
Error -200279 occurred at DAQmx Read (Raw 1D U8).vi:5860001
Possible reason(s):
The application is not able to keep up with the hardware acquisition.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0
Task Name: USB6356_Acq_DI_port0
02-04-2016 12:33 PM
So you are acquiring data at a 1MS/s and have a buffer of 1kS. So your buffer is good for 1ms. Good luck with that! You need to increase your buffer a lot, closer to 100kS (0.1s worth of data).
Also, look into using the DAQmx Configure Logging VI before you start your task. This will allow you to stream the read data straight to a TDMS file. No extra file/IO, no producer/consumer. DAQmx does all of the work for you.
02-05-2016 03:51 AM
Thanks, I have tried with several different buffer sizes but the results still don't vary.
With a buffer of 100k I have measured the time at the beginning and at the end of execution and these were the results:
Start time: 10:49:28,055
End time: 10:49:33,660
(execution time=5,605 seconds)
Number of samples in array: 22310024 (about 4 times what it should be with a sampling rate of 1M)
I'm going to have a look at the Configure Logging VI.
02-05-2016 07:02 AM
What I have discovered is that the captured array is somehow interleaved with 0s. In the two captures that I have attached you can see how I send a pulse to p0.6 and when zooming in only 1 out of 4 samples has the correct value (the rest are 0).
02-08-2016 03:14 PM
Although your USB-6356 has only 8 HW timed digital lines, the device returns 32 bits of data with each sample. If you read raw data, you will read this, and I'm not surprised it shows up as zeros interleaved with the data you're interested in.
Dan
02-09-2016 06:29 AM
Thanks Mcdan,
makes sense. I have simply decimated the array and kept the significant byte.