Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Use a DAQmx write to increment a counter

$
0
0

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.


Viewing all articles
Browse latest Browse all 1271

Trending Articles