08-21-2020 09:05 AM
Hi,
I'm facing an issue with the sample clock settings for a linear encoder.
I have a NI 9402 module attached to a NI 9191 cDAQ module. The signals A+ and B+ are connected to the PFI0 and PFI2 terminals of the NI 9402, respectively. The encoder delivers signals with a frequency of up to 50 kHz (0.0006 m spacing at a velocity of up to 30m/s), so I guess also my sample rate should be >=50 kHz to detect any movement (or am I wrong?).
For testing purposes I'm using NI-MAX to visualize the signals for now.
Whenever I want to measure in continuous mode, I have to define an EXTERNAL sample clock source. In the drop-down menu in the advanced timing tab of the linear position task I can choose between several channels of the cDAQ module, none of them is working, though (e.g., I'm getting a signal routing error -89136).
I've also been trying to use the PFI0 channel itzself as sample clock, however, apparently I am missing data points in this case as the measured length is wrong.
According to the data sheet the NI 9191 cDAQ module has 4 internal counters. Is it possible to use one of these timers for my linear encoder task programmatically (in LabVIEW) somehow?
All four digital IO ports of my NI 9402 are in use, so there is no chance to make an external signal routing.
I've searched the entire internet (😉) for days now without finding a solution for my specific problem.
Any help is highly appreciated...
Solved! Go to Solution.
08-21-2020 10:44 AM
A picture's worth 1000 words, right? See if this snippet help. I'm not nearly as familiar with cDAQ as with desktop boards, but I think this should at least be pretty close. You'll need to substitute in your own chassis and module names though.
-Kevin P
08-21-2020 11:00 AM
Hi Kevin,
wow, great!
At the moment I could test your code only on a simulated device, where it worked like a charm.
I'll test it on the physical system next week.
Thanks a lot for your help, especially for the good comments in the code snippet!
s