This code will synchronize a 9237 strain task with a counter input task for frequencies lower than 1613 Hz.
When measuring from a NI 9237, the minimum frequency is 1.613 kHz. For a counter measurement of frequency with a NI 9401, your sample clock rate must be slower than your measured frequency. In the case that the measured frequency is less than sampling rate, you will get error -201314. This error instructs to lower the sample rate, which is impossible to do directly and still directly share the 9237 sample clock.
To lower the sampling rate of the 9401, you can use a counter output task to decimate the 9237 sample clock. This will still allow the 9237 and 9401 measurements to be synchronized.
Requirements to Run
LabVIEW 8.6 or compatible
DAQmx 9.5.1 or compatible
NI 9237 module
NI 9401 module
NI 9174 or NI 9178 cDAQ Chassis; potentially works with others, unteested
Steps to Implement or Execute Code
Input your encoder to ctr0 of the 9401
Externally wire PFI lines 0 and 7
Wire your strain gauge channels to the 9237 as normal
Adjust the frequency of the decimated 9237 timebase to be lower than your lowest expected frequency. Do not measure an encoder at a frequency lower than your counter output task. 100 Hz is the default in this example.
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Patrick W. Applications Engineer National Instruments