06-28-2010 04:56 PM
I am attempting to read the angular position of an indexed quadrature encoder using a NI-6215 DAQ card. I seem to be having a problem with the index signal (channel Z) however. I keep getting false positive edge counts on this channel that resets the position to zero at random times (the encoder position rarely makes it to 180 degrees). When I use a counter to count rising or falling edges on channel Z only, I also get several edges counted per revolution (not the same number each time). When I read the Z channel as an analog input though, it looks exactly as it should; a single 5 V pulse once a revolution. Therefore I don't know where these phantom edge counts are coming from. Does anyone have any ideas? I do not have much experience using these counters.
Thanks,
Danny
06-29-2010 01:09 PM
Hi Danny-
This behavior is going to be specific to your device, as stated in the 6215 User manual, quoted here:
Channel Z Behavior
Some quadrature encoders have a third channel, channel Z, which is also
referred to as the index channel. A high level on channel Z causes the
counter to be reloaded with a specified value in a specified phase of the
quadrature cycle. You can program this reload to occur in any one of the
four phases in a quadrature cycle.
Channel Z behavior—when it goes high and how long it stays
high—differs with quadrature encoder designs. You must refer to the
documentation for your quadrature encoder to obtain timing of channel Z
with respect to channels A and B. You must then ensure that channel Z is
high during at least a portion of the phase you specify for reload. For
instance, in Figure 8-17, channel Z is never high when channel A is high
and channel B is low. Thus, the reload must occur in some other phase.
In Figure 8-17, the reload phase is when both channel A and channel B are
low. The reload occurs when this phase is true and channel Z is high.
Incrementing and decrementing takes priority over reloading. Thus, when
the channel B goes low to enter the reload phase, the increment occurs first.
The reload occurs within one maximum timebase period after the reload
phase becomes true. After the reload occurs, the counter continues to count
as before. The figure illustrates channel Z reload with X4 decoding.
Could it be that the counter channel where you detect more than one rising edge is sampling faster than your counter channel? This could potentially explain why you are detecting multiple edges on the counter and only one on the analog channel - you might just be missing some edges.
I hope this helps. Best of luck with your application!
06-29-2010 01:13 PM
How do you have it wired? Is it open collector or closed? What model is it? What manufacturer?
07-02-2010 03:20 PM
Thank you for the replies.
I am not sure what you mean by open collector or closed. The encoder is in Precitech Diamond Turning Machine. I do not know the manufacturer or model of the actual encoder. Are you trying to figure out what kind of signal the encoder should be sending?
I have had the encoder wired in various ways for troubleshooting. For the initial quadrature encoder measurements, I had channel A of the encoder wired to pin 1 (P0.0), channel B to pin 2 (P0.1), and channel Z to pin 3 (P0.2), and the encoder ground connected to pin 5 (DGND). When I was testing the channel Z edge counts, I had channel Z wired to pin 4 (P0.3) and the encoder ground connected to pin 5 (DGND). For the analog input tests, I had channel Z wired to pin 17 (Ai1+) and the encoder ground wired to pin 18 (Ai1-).
For the analog input tests I was acquiring at 1 kHz and turning the spindle very slowly. This allowed me to capture >20 points while the channel Z signal is high during each revolution. It is highly unlikely that I was missing other peaks in the signal. How does the DAQ card counter actually work. Is it looking for the channel to surpass a threshold value, or is it looking for the slope (time derivative of the channel value) to surpass a threshold? I can see the later case being suseptible to noise.
Thanks,
Danny
07-07-2010 02:27 PM
Hi Dan-
Have you tried to measure the phantom edges on more than one counter? Like on both counter one and counter zero? How about another DAQ card? And are you acquiring the data using LabVIEW?
Have we verified that the encoder is actually functioning correctly? I am thinking that you may actually be detecting noise. The 6215 does not have digital filters, so you can try to set up your own. Or, you can acquire one of our DAQ cards that has digital filters (go to www.ni.com/DAQ to search for cards that meet your specifications).
Best of luck!
07-07-2010 03:43 PM
Look at this tread see if this helps.