To download NI software, including the products shown below, visit ni.com/downloads.
Overview
The example is to demonstrate how to acquire the angular position and velocity of an encoder with one counter
Description:
This VI would show how to define the counter input of a pin and utilize it as the hardware for the acquisition of the angular position and the velocity. It also somewhat shows how to synchronize the the counters by wiring the error cluster of the function.
Steps to Implement or Execute Code:
To implement this example:
To execute this example:
Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 9.0 or compatible
Hardware
cDAQ with C series Counter and Analog Input Module
**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.
Thanks for your posting. Can you please elaborate a little on how dummy AI task is used to synch two counters to the same sample clock?
Also please post a LV 8.6 or 8.2 version, if possible.
The AI task is used to generate a Sample Clock that can be used by the counter tasks. Since I am setting up a buffered coutner task, it needs a sample signal from somewhere else. The most popular options for generating this clock signal are from another counter, an AI task, or an AO task. Since I am already using my only two counters on the board, I chose to create an AI task for the sole purpose of generating a clock signal to be used by the two coutners. Both counters are sharing the same clock signal. This gives then a sample clock that is required and ensures that the counter readings are synched together.
Hope this helps. Here is another example that may be better documented.
http://zone.ni.com/devzone/cda/epd/p/id/6081
Thanks for the explanation and the link.
Could you please explain more clearly how to use the sawtooth generation function to measure the velocity. Why do you use the initial phase at 180 deg with the off set 100, but not 0 deg phase with zero offset? What is the frequency of the sawtooth generation function affect the velocity measurement? I use your VI to mesaure the velocity of the DC motor throught 2500 ppr encoder, but the velocity is oscilated. It is not constant eventhought i supply a constant voltage to the motor. How can i measure angular velocity accuracely?
Thanks in advanced.
For reference, error handling is disabled in this VI. If you try to use the code in another VI without turning off automatic error handling or clearing the error (-200077 I believe), you might run into an issue with the DAQmx Timing VIs on the encoder tasks. It still works if you ignore that though.
Would you please upload the modified file with just the bottom row task? I only need one encoder measurement and I deletd the the first two tasks but there were some errors, in relation to mismatch between data source and destination.