Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Arm a counter for a finite number of samples?

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?  

0 Kudos
Message 1 of 4
(3,601 Views)

saratoga

 

Do you want the counter to continue counting in between the arming triggers, but not display the count until the next trigger?

 

Applications Engineer

National Instruments

0 Kudos
Message 2 of 4
(3,575 Views)

I would like it to keep counting, but to ignore any triggers until it is rearmed.  

0 Kudos
Message 3 of 4
(3,567 Views)

I'd use a 2nd counter whose job is to act as an intermittent sample clock for the 1st counter.   Your 1st counter can be set for continuous sampling and the task can be left running all the time.  Just configure it to use the 2nd counter's output as its sample clock. You can then control when the 2nd counter generates those sample clock pulses through software Start/Stop calls, pause triggering, maybe finite generation (depending on which DAQ board you have).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(3,562 Views)