Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous circular buffer read with overwrite

Solved!
Go to solution

Trying to accomplish the following with no luck so far:

 

Setup a a DAQmx read buffer in a way such that

 

  • all overruns are allowed
  • can read a half buffer at anytime (whole buffer won't work, because of following requirement)
  • read is relative to the most recent sample, whether any of the data has been previously read or not.

 

 

 

 

 

If I am truly asynchronous, I should be getting the most recent samples (some of which may or may not be 'old' or read by the previous call)with no delay at whatever times I choose to call DAQmx Read. So far, I am getting a dleay consistent with a half-buffers worth of data.

 

Playing with the follwoing settings didn't get me what I was looking for. I thought the following combination might work:

Overwrite Unread Samples

Read Relative to Most recent

Read size = buffer size/2

 

 

I can do all this separately without the DAQ buffer; that is not the issue. Call it an exercise if you like - I'm just curious if it can be done with the DAQmx read buffer. 

I guess what I'm really asking is if the Read Position pointer can be ignored.

0 Kudos
Message 1 of 3
(3,760 Views)

You are absolutely on the right track.  I've done many apps with this kind of requirement -- data acq hw is always scanning into and overwriting their RAM buffers, various parallel processes can request a chunk of "most recent data" at any time.

 

There's just one DAQmx property you didn't mention, so I can only guess that's where the problem is.  When you drop down the

DAQmx Read property node to specify  "relative to most recent", expand to the next property "Offset."    Here's how it works: to read the N most recent samples, specify Offset==negative N, and wire N to the following DAQmx Read call

 

read_recent.png.

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 3
(3,735 Views)
Solution
Accepted by FTI_Newton

That works really well, thank you. Smiley Happy

 

0 Kudos
Message 3 of 3
(3,731 Views)