Hi Yin Lu,
You'll need to be running a continuous pulse train generation task
on the other counter to generate the gate signal for the buffered event
counting, as you already mentioned. An example program that does this can be found in the NI
Example Finder under Hardware Input and Output » DAQmx » Generating
Digital Pulses » Gen Dig Pulse Train-Continuous.vi.
Here's a document that discusses how to do buffered event counting with NI-DAQmx.
Buffered Event Counting
http://zone.ni.com/devzone/cda/tut/p/id/5404
An example program that does this can be found in the NI Example Finder under Hardware Input and Output » DAQmx » Counter Measurements » Count Digital Events » Count Digital Events-Buffered-Continuous-Ext Clk.vi. For the sample clock source, you will want to use CtrXInternalOutput, where X is the counter you use for the pulse train generation. If you are not able to see this terminal on the drop-down menu, you may have to right-click on the Sample Clock Source control and select
I/O Name Filtering... When the Filter Names pop-up appears, make sure to check
Include Advanced Terminals. Then the CtrXInternalOutput should be available.
The gate signal will latch values into the buffer, so if you want the
number of edges between each gate signal, simply process your output
array by subtracting the previous element from each element of the
array.
I hope this helps to get you started. Let me know if you have further questions or if you have more specific errors or problems you would like to discuss.
Getting Started with NI-DAQmx
http://zone.ni.com/devzone/cda/tut/p/id/5434
Regards,
John Bongaarts