11-08-2013 02:55 PM
I have a program that is writing output waveforms which go to some actuators, then some strain cards that are being read (essentially command-response). The issue we have is that we are always reading and logging, even when a test isn't running and nothing is being output to the actuators. This is done so data is still captured in the case where the parts may somehow go into resonance and break (yes this does happen). There are some weighted average calculations we need to do based on the number of waveforms that have been output and responses read, but we are trying to ensure the responses read line up with the correct sine wave output. My thought was if we could somehow use a buffered counter which was incremented every time a write was performed, then read every time a read was performed, we could ensure the data read is lined up with the correct count.
Now, in general, the data that is output should align with the data that's read, and we could hold a counter in software. I just foresee a potential problem where for some reason the daq read loop gets a little behind and we do two writes before we do a read. Then our software counter would be +2 but the data we had actually read off the hardware buffer into software would be behind. This would throw off our calculation.
I don't know if this makes sense, so feel free to ask clarifying questions.
11-08-2013 03:28 PM
Hi Greg,
What card are you using?
@for(imstuck) wrote:
My thought was if we could somehow use a buffered counter which was incremented every time a write was performed, then read every time a read was performed, we could ensure the data read is lined up with the correct count.
Does performing a "write" equate to starting a finite analog output task? If so, you could count /<DevName>/ao/StartTrigger using a counter, and sample the count using /<DevName>/ai/SampleClock so you know which samples belong to which output waveform.
Best Regards,
11-08-2013 04:04 PM - edited 11-08-2013 04:06 PM
@John_P1 wrote:
Hi Greg,
What card are you using?
@for(imstuck) wrote:
My thought was if we could somehow use a buffered counter which was incremented every time a write was performed, then read every time a read was performed, we could ensure the data read is lined up with the correct count.
Does performing a "write" equate to starting a finite analog output task? If so, you could count /<DevName>/ao/StartTrigger using a counter, and sample the count using /<DevName>/ai/SampleClock so you know which samples belong to which output waveform.
Best Regards,
It's set up as continuous but no regeneration, we may be able to switch to finite. This may work I'll have to digest this option and play around with it some. Admittedly, I've somewhat checked out mentally for the weekend . Strain cards are 4330 and I have to go look at the AO card but I do know they are not PXIe.