11-14-2007 07:07 AM
11-14-2007 07:17 AM
If working in LabVIEW, there are DAQmx property nodes that will allow you to set the "initial count" value, but ONLY while the task is stopped.
If you can't count on a hardware z-index reset, another software technique I've used to avoid stopping the DAQmx task. I make a wrapper function for all my encoder task access (see the Action Engine nugget for ideas...). Inside this "Action Engine" wrapper, I use an uninitialized shift register to store my encoder's "virtual 0". I add a simple function to the action engine for setting the "virtual 0" to be the current encoder position value. Every time I read from the encoder, I first subtract off the virtual zero before returning the data. As far ast the rest of the app is concerned, the encoder data it gets is just as if I were able to make a software call to DAQmx to set the raw count to zero.
-Kevin P.
11-14-2007 07:22 AM
11-14-2007 07:53 AM
Yeah, it'd be really nice if NI supported a count reset (or "reload" for non-zero values) based on a hardware edge coming in, regardless of A,B phase, and regardless of whether we are in position measurement mode, or edge counting, or (perhaps) other modes. If you agree, add your voice to mine at the Product Suggestion Center.
-Kevin P.
11-14-2007 08:11 AM
Done.
Will