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

Arm a counter for a finite number of samples?

$
0
0

I have been successfully using a counter to read out a quadrature encoder syncronously with an external clock.  Now I would like to try syncing this to a series of regular start triggers so that I only acquire data when the position sensor is actually being actuated.  The goal is to have a trigger start reading out the encoder using the clock, acquire a fixed number of measurements, and then ignore clock edges until the next trigger occurs, at which point the sync should begin again.  If I understand correctly, the way to do this is to:

 

1)  Setup the counters using the clock and encoder pins via CreateAngularEncoderChannel and ConfigureSampleClock.

2)  Use ArmStartTrigger to set the trigger to arm the acquisition

3)  Call a function like ReadMultiSampleDouble or use a callback to read the samples at the end of the acquisition.

 

Unfortunately, if I set ConfigureSampleClock to FiniteSamples, the counter is reset between calls, when actually I need it to preserve the encoder position between calls, just ignore clock edges.  If I set to ContinuousSamples, the counter (if I understand correctly) remains armed and will generate samples independent of subsequent triggers which is not what I want. Is there a way to do a finite acquisition of X samples on each trigger, but continue counting until the next trigger?  


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>