Example Code

Use Counter to Create a Clock for a Buffered Edge Counting Task

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This example shows how to do a buffered edge counting task using another counter on the same board to generate the sample clock.

Description

This example was developed for the PCI-6602 but is applicable to all boards with two counters that support buffered acquisition.

The rate at which the count is sampled must be the same as the clock used in the counter input task. The onboard clocks cannot be used because they are too fast for this task. Instead of using an external clock to solve this problem, a second counter can be used to generate the clock at a specified sampling rate.

Requirements

Software

  • LabVIEW 2009 SP1 or compatible
  • DAQmx 9.0 or compatible

Hardware

  • Most DAQ cards with counters

Steps to Implement or Execute Code

1. Generate a pulse train using a counter output task. Set the frequency of the pulse train equal to that at which you want to sample the edge count.

2. Create an edge counting counter task.

3. For the sample clock, choose the output of the counter used to generate the pulse train. Some cards allow you to route this internally. For others, an external wire may be required.

Additional Information or References

buffered_edge_counting.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Tanya Visser
National Instruments
LabVIEW Group Manager

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
AZimmer
Member
Member
on

Thanks so much for this.  I was having a heck of a time, but the example sorted things out for me on how to know when the counter was incremented.

Cheers,

Andre

Contributors