Antonios,
The shipping example VI Count Edges does what you describe.
>Quoted from VI Description
Count Edges (DAQ-STC).vi
DESCRIPTION:
This VI counts rising edges, using an STC based device (e.g.: E-series). The counter increments its event count everytime a pulse comes into its source input. A gate signal can be added such that if a low signal occurs on the gate, then the counter will pause (scroll the front panel left to access the gate settings). The current value of the counter is read continuously in the while loop, until the Stop button is clicked or an error occurs.
I/O CONNECTIONS:
Connect the gating signal, if any, to the gate input of the selected counter.
If you selected the Source Selection to be "PFI line", connect your event count base signal to the PFI line indicated by "Source PFI line number used". (If you selected "Internal Timebase", no source connection is necessary.)
NOTE: For actual I/O pin numbers, please refer to your hardware user manual.
INSTRUCTIONS:
1. Enter the device and counter you want use.
2. Make your Source selections, as desired.
3. Optional controls are located on the left side of the front panel. You will have to use your scroll bar to reach these.
4. Connect your signals as described below in I/O CONNECTIONS.
5. Run the VI.
>End quote
If you look inside the Diagram of the Count Edges VI you will see a subVI, Group Config CTR, that has a constant set to "simple event counting." This configures the gate in the correct manner. You have 17 or so options to choose from (right-click to see the other choices). Each choice configures the counters as needed. No special effort is needed on your part.
If you really must know more details double-click on the Group Config CTR icon. On the Diagram of that VI is a Call Library function. Right-Click that and see more ugly details that you don't need to know. The functions of the counters are fully implemented by the options already available, so you don't need to know how the details, but it is intersting.
Hints:
Keep in mind that the counters require TTL level signals. 0V to 5V. Limit the current to the level the DAQ board can handle. You will false trip the counter if your low is higher than 0.8V. I have had problems with this when using noisy signals.
Also make sure you debounce any switches you wire to the counters. It is instructive to hook up an unbounced switch to the counter inputs and see just how many false trips they can generate!
Mike