Why Can't I Choose the Internal Clock in DAQmx Counter Input Example Programs?

Updated Jan 6, 2023

Reported In

Hardware

  • PCI-6602

Software

  • LabVIEW 2017 Full

Driver

  • NI-DAQmx

Issue Details

  • I want to acquire buffered signals from three quadrature encoders and translate those signals into angular positions
  • I'm using one of LabVIEW's counter input example VI, and it requires providing an external clock
    • Eg. Read Encoder (Continuous Clock) VI
  • I do not have an external clock signal, so I want to use an internal clock

Solution

This behavior points to the fact that the counter task being configured does not have an internal sample clock available. To get around this, we can internally generate our own clock with another counter and use it as the sample clock. Here is how to do that:
  • Open LabVIEW's Example Finder
  • Open the example in Hardware Input and Output >> DAQmx >> Counter Output >> Counter - Continuous Output VI
  • Specify one of your DAQ device's internal counters.  For example, if you are using ctr0 for your encoder measurement, use ctr1 for output.


We can then reference this internal clock in our original counter input example VI:
  • Set that counter's internal output as the Sample Clock Source


Note: You will need to start the pulse train generation before starting the counter measurement

Additional Information

Generating a pulse train from a counter and using it as a sample clock is known as correlating signals.