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

Counter pulse generation issues when synchronizing with analog output sample clock

$
0
0

Hello,

 

The device I am using is a NI USB-6229 USB. I have written a program that produces a finite sine wave on the analog output that consists of 200ms worth of samples. In addition to the analog output, I am trying to turn on 2 counters for the duration that the analog output is active.

 

I experience an issue depending on how many high ticks I define for the counter. The counter output works as expected as long as the number of high ticks is less than the number of samples I am generating for the sine wave. For example, if I configure the counters to use a number of ticks equal to 100ms I get the following output on my oscilloscope.

 

Note: Analog output shown in yellow, counter 0 is D0, counter 1 is D1, & D2 is my start trigger signal.

scope_3.png

 

 

The counter output does not work as expected if the number of high ticks is equal to the number of samples I am generating for the sine wave. For example, if I configure the counters to use a number of ticks equal to 200ms, I get the following output on my oscilloscope.scope_4.png

 

 

The expected behavior is that the counters would have been set to low at the same time that analog output 0 returns to 0V. But, one will notice that D0 & D1 (counter 0 & counter 1 respectively) stay high for longer than expected. If we zoom in, in-time on oscilloscope we can see that counter 0 turns off roughly 5ms after the analog output returns to 0 (this is shown in the screenshot below). We can also see that counter 1 turns off roughly 1ms after counter 0 returns to 0.scope_5.png

 

 

This behavior is not acceptable for my application. I need to get the analog output & counters synchronized such that the counters turn off when the analog output is complete.

 

I have attached a sample project that demonstrates this behavior.

 

How can I solve this issue?


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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