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

External sample clock with encoder

$
0
0

Hi everybody,

 

I have an external encoder wired to a 9423 module on a 9185 chassis, where i count the impulses of the encoder using channel A and B.

I also have some sensors connected to a 9205 analog Input module. Now I want to use the counter as a sample clock on the PFI on the 9205 module. So basically I have to route the counter signal to the PFI. At least I think that is the best approach. No idea how though. Probably easy with LabView, however I am not using it. Instead I am using Matlab or VS\C++.

 

If I connect one channel (A or B) ´from the encoder to PFI on the 9205,  I can set up the clock without a problem as an external clock connection. Then I wait until x-samples are gathered and execute some functions.

 

So basically my question is, if it is possible to use the counter from the digital input module (I have an output module too, it that helps) as a means of controlling the sampling rate of the analog module? Or am I looking at this wrong?

   

Here the basic set up in Matlab, if it will do any good.

s = daq.createSession('ni'); % Create session

ch1 = s.addAnalogInputChannel('cDAQ9185-1C7CD64Mod1','ai0', 'Voltage'); % analog Input channel

cc = addClockConnection (s,'External','cDAQ9185-1C7CD64Mod1/PFI0','ScanClock'); % set an external clock (e.g. channel A from the encoder)

 

Cheers


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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