Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Resettable Pulse Counting With an NI Counter/Timer Board or M Series Device

Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Base Package
Hardware: Counter/Timers (TIO)>>Devices>>PCI-6601

Problem:
I want to count edges on an input signal and reset this count based on another pulse signal using an NI Counter/Timer Board or M Series Device.

Solution:
This type of task can be performed with any NI M Series or Counter/Timer board that has a single counter, if external signals are being used. A Counter/Timer board is especially convenient for creating the signal that resets the count, because another counter can be used to generate a pulse signal of a known frequency.

There are two ways to do this using a counter input. The first is use a two pulse encoder task with the Z Index enabled. This task uses two input signals, channel A and channel B, to count and one signal to perform the reset (Z index). A two pulse encoder is also known as an up/down counter, because a rising edge of channel A counts up and a rising edge of channel B counts down.

The signal connected to the Z index resets the count depending on the conditions set for the values of channels A and B (referred to as A phase and B phase in the driver software). This simply allows you to specify exactly when the reset will occur during your count so you can avoid missing any input pulses from either channel A or B. The reset will occur within one cycle of the maximum timebase.

As a specific example, if we are only concerned about counting up, channel B can be grounded. The connections for this setup are as follows.

Ctr Source: Count Up Signal (Channel A)
Ctr AUX:Count Down Signal (Channel B) - Connected to GND
Ctr Gate: Reset Signal (Z Index)

A picture of how the reset works with the counter signal state as A low B low, is shown in the following picture.



The 6601/6602 User Manual talks about the Z index on page 39 of 100 and the M Series User Manual talks about the Z index on page 120 of 424.

A very simplistic example VI of using the Z index is attached below.

The second way to perform this measurement is using a buffered period measurement. This process is documented in an example on the NI Developer Zone website.

Related Links:
Product Manuals: 6601/6602 User Manual
KnowledgeBase 3NKB0DO8: What Is a Two Pulse Encoder?
Developer Zone Example: NI-DAQmx: Buffered Period Measurement With External Counter Source
Product Manuals: M Series User Manual

Attachments:
Counter Reset Example.vi




Report Date: 11/03/2008
Last Updated: 01/02/2009
Document ID: 4R2HA80O

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit