03-09-2009 12:15 PM
Hello,
I've inherited a program that uses an encoder to read the position of a torque-arm. The program uses traditional daq. The encoder position data is read using "Counter Read Buffer.vi". Then, by simply casting the output of "Counter Read Buffer.vi" to an I32, the position data can be either positive or negative.
1. Is this a valid method of using "Counter Read Buffer.vi"? (I wonder because if I capture data as I move the torque arm back and forth, the data suggests that the encoder is not moving back to zero counts each time. For example, the first time the arm is moved through its range, it might go from 0 counts to 100 counts; the second run may be from 10 counts to 110 counts, the third from 15 to 115 and so on).
2. Is something this simple available in DAQmx too, or do I have to monitor each encoder point that I read to detect when the counter rolls over and handle it manually?
Thanks in advance for any assistance!
Chris
03-10-2009 02:56 PM
Hello Chris,
For the answer to your first question, this may be an issue with the DAQ device you are using. What exact device are you using?
For the second part, the Measure Angular Position VI, found in the Example Finder under Hardware Input and Output»DAQmx»Counter Measurements»Position, is a good quadrature encoder VI for reading angular position.
Try using this example and see if the behavior is different between the Traditional DAQ and NI-DAQmx code and let me know how it goes.
Regards,
Dan King