Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Do I have to use an external clock with a cDAQ-9188 and NI 9401 to read a linear encoder? I'm seeing error message that implies that but the example code doesn't show it.

We can set up a task that works on demand but when we go to continuous sampleing we see Error -200303, which claims an external sample clock source must be specified for this application.  However, some of the NI linear encoder example code doesn't show that (uses the cDAQ 80 Mhz clock) and the documentation didn't mention that. 

0 Kudos
Message 1 of 3
(5,482 Views)

It's mentioned in the 918x user manual:

 

Unlike analog input, analog output, digital input, and digital output, the cDAQ chassis counters do not have the ability to divide down a timebase to produce an internal counter sample clock.  For sample clocked operations, an external signal must be provided to supply a clock source.  The source can be any of the following signals:

  • AI Sample Clock
  • AI Start Trigger
  • AI Reference Trigger
  • AO Sample Clock
  • DI Sample Clock
  • DI Start Trigger
  • DO Sample Clock
  • CTR n Internal Output
  • Freq Out
  • PFI
  • Change Detection Event
  • Analog Comparison Event

 

Assuming you have at least one available counter (there are 4 on the backplane), I would suggest to configure a continuous counter output task and use its internal output as the sample clock.  Specify the internal counter using an "_" for example "cDAQ1/_ctr0".  The terminal to use for the sample clock source would be for example "/cDAQ1/Ctr0InternalOutput".

 

Which example uses the 80 MHz timebase as a sample clock?  It is far too fast for a sample clock on the 9188 according to the throughput benchmarks (80 MHz * 4 byte samples = 320 MB/s).  There is also no direct route between the 80 MHz timebase and the sample clock terminal for the counters--making this route would use a second counter anyway.

 

 

Best Regards,

John Passiak
Message 2 of 3
(5,478 Views)