Quantcast
Channel: Measurement Studio for .NET Languages topics
Viewing all articles
Browse latest Browse all 2018

Using external clocking to implement a frequency divider in .NET

$
0
0

Hi,

 

I've modified one of the example .NET projects to take an external clock over PFI0 and then output half the frequency on PFI1 by writing out a 0,1,0,1 ... waveform clocked by the PFI0.  

 

My code is here:

 

http://pastebin.com/qrtJNYWA

 

This works great, but I have several questions:

 

1)  The arguments to WriteMultiSamplePort are int32, does this mean that I'm changing all the PFI lines everytime I write to this?  So bit 0 is PFI 0, bit 1 is PFI 1?  Sorry for a basic question but I could not locate any documentation about what this function does.

 

2)  When I feed it a small buffer (say 2 words) it fails with a buffer underrun for high external frequencies.  Am I right in thinking that setting ConfigureSampleClock to ContinuousSamples+Rising Edge means that every rising edge it consumes one word from that buffer and copies it over the PFI pins?  And then when the buffer is depleted it starts again from the start?  

 

Finally, does this approach make sense?  It works well enough, but I have a sneaking suspicion that theres a more elegant way to do this using counters or something like that :)

 

Thanks,

Mike


Viewing all articles
Browse latest Browse all 2018

Trending Articles



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