10-11-2012 08:36 AM
Hi all,
I have a PCI-6036E card which has an encoder signal connected to CTR_0_SRC (PFI8) input. When a try to read encoder counts I get a duplicated value. My card doesn't support the "Duplicate Count Prevention" property. How can I solve this problem?
In addition I have the encoder channel B connected to GP_UP_DOWN (P0.6) input to detect movement direction.
Thanks a lot in advance.
Regards
Maria
10-11-2012 11:27 AM
First, the technique you're using is not the best approach. Real quadrature decoding is much more robust. But if you're stuck with a short deadline and nothing but your E-series board, you have a decent chance to get pretty good results that way.
The big things to watch out for are that count errors may occur and accumulate during direction reversals, and *will* occur if you have vibration that oscillates across the "A" edge but not far enough to toggle "B".
Having said all that, are you sure that the duplicated value you read isn't simply the truth? Could you be capturing / reading values fast enough to get 2 reads within 1 cycle of "A"?
-Kevin P
10-15-2012 03:19 AM
Hi Kevin,
thanks for your answer, but, yes, I'm sure about read counts, because I can read them with an oscilloscope and I checked that counts I get with my card are about the double of counts read with oscilloscope. And, yes, I assume I'll get errors, but not 100%.
I don't know the technique you mentioned to get encoder counts, can I implement it with this card. I have to use this card since I have to integrate this reading into an existing system.
Can I design my code in such a way to get good values?
Thank you.
Regards,
Maria
10-15-2012 09:13 AM
A similar situation came up again when I had a couple minutes to do just a little research. I'd highly recommend adding a quadrature converter circuit between your encoder and your data acq board. This reply has a link to one such quadrature-to-clock-and-dir converter.
-Kevin P