01-18-2006 09:02 AM
01-18-2006 02:47 PM
What example code? What hardware board? DAQmx or traditional NI-DAQ?
I would think that a buffered position measurement would be pretty straightforward approach. There should be an example or two to get you started. Basically, one counter measures the quadrature encoder's position while the other generates a sampling clock. For any interval, the average speed is the change in position over the elapsed time between those positions. The sign of the position change gives you the sign for direction.
Post back if you need more specifics...
-Kevin P.
01-18-2006 10:45 PM
01-19-2006 08:23 AM
Scott,
1. Unfortunately, there probably isn't any reliable way to perform a "clocked reset" if your quad encoder doesn't have an index pulse. Any external signal you may want to use isn't likely to meet the polarity and timing requirements required by the "z index reload" feature. I agree that there's many apps that need more flexible options for "z index reload" and I put it high on my personal wish list for counter features as seen several posts into this thread.
However, if your main purpose for resetting position to 0 was for ease in calculating velocity, then you'll be better off with a buffered position measurement anyway. That will give you hardware timing on the position readings. Using software timing to occasionally query position would become a major source of noise in your velocity calculations.
2. For a sampling clock, there are two steps. First create it, second use it. To create it, configure another counter to generate a pulsetrain -- for starters you could simply run a pulsetrain example in parallel with your encoder measurement vi. To use it, you'll need to place a DAQmx Timing vi in the config chain before starting the task. There you'll need to specify that the source of the sampling clock should be the output from the pulsetrain counter. You'll also need to wire in a value for "sampling rate".
3. For future reference, you can often get a more precise measurement of speed by performing a frequency or period measurement. The downside is that you wouldn't get any direction information from this approach so it's mainly useful when you know a motion will be unidirectional throughout the measurement time.
-Kevin P.
01-31-2006 01:43 PM
I agree, buffered position measurement is the right way to go. I have done this with the 6602 and a quadrature encoder and the results are very good for velocity and even acceleration.
01-31-2006 03:07 PM
02-01-2006 06:50 AM - edited 02-01-2006 06:50 AM
Message Edited by WantToGolf on 02-01-2006 06:51 AM
02-01-2006 07:31 AM
02-01-2006 07:54 AM
Just adding a little to WantToGolf's good advice...
Using period measurement may very well give you a more precise RPM reading than you'd get by measuring position and taking a derivative. However, period measurement alone won't be able to distinguish direction -- you'd need to handle that separately. What are your needs for precision? How frequently do you need to sample a new RPM value? How many pulses/sec will your encoder be producing?
Also, can you explain your interest in the z-index reset function? It's going to be difficult to use it unless your encoder produces its own index pulse, though there are some schemes that'll work for uni-directional measurements. Also it can only be used in a position measuring mode, not in any other mode like period measurement.
-Kevin P.