To download NI software, including the products shown below, visit ni.com/downloads.
This VI demonstrates how to count digital events on a Counter Input Channel.
In this VI， the Initial Count, Count Direction, and Edge are all configurable. This VI shows how to use a secondary counter and a digital input line to count events for a specified amount of time, following an external digital trigger. Edges are counted on the primary counter's default input terminal, but it could easily be modified to count edges on a PFI or RTSI line.
The input counter will count edges on the input terminal of the counter specified in the left Physical Channel I/O control. The gating counter will generate a digital pulse on the output terminal of the counter specified in the right Physical Channel I/O control. Connect the default output line of the gating counter to the default gate line of the input counter. This will allow the gating counter to control when the input counter can count events. In this example the input counter will count edges on the default input terminal on ctr0, and the gating counter will generate a digital pulse on the default output terminal on ctr1. Connect your start trigger source to the appropriate connection specified by "Start Trigger Source" on the front panel.
For more information on the default counter input and output terminals for your device, open the NI-DAQmx Help, and refer to Counter Signal Connections found under the Device Considerations book in the table of contents.
Steps to Implement or Execute Code
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.