Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect sampling rate of port 0 on USB6356

Solved!
Go to solution

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?

0 Kudos
Message 1 of 9
(4,727 Views)

You should start your task before the loop.

 

Can you share the rest of your configuration?  Perhaps something is wrong in there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(4,715 Views)

Thanks, I have now added the Start Task VI before the loop.

 

here is the configuration for the task in MAX

0 Kudos
Message 3 of 9
(4,708 Views)

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

Download All
0 Kudos
Message 4 of 9
(4,704 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(4,685 Views)

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. 

0 Kudos
Message 6 of 9
(4,671 Views)

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). 

Download All
0 Kudos
Message 7 of 9
(4,665 Views)
Solution
Accepted by topic author thehun

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

Message 8 of 9
(4,622 Views)

Thanks Mcdan,

 

makes sense. I have simply decimated the array and kept the significant byte. 

0 Kudos
Message 9 of 9
(4,569 Views)