07-16-2008 07:07 AM - edited 07-16-2008 07:08 AM
07-16-2008 09:37 AM
07-16-2008 09:48 AM
Can't look at your code from here, but have a few possible educated-guess thoughts.
First, clever idea to use both the (A,B) and (/A,/B ) pairs! I don't think I've seen that before. It even appears to help with the dithering that can occur during vibration across one of the transitions, though I'm not sure I've analyzed that completely.
Anyway, here's my guess. Your technique depends on summing the count value from 2 independent tasks. In simple event counting mode, you read them in quick succession. Though your reads are not truly sync'ed in time, they are close enough that you don't observe any obvious miscount errors. Also, any such miscounts wouldn't tend to accumulate.
As you switch to buffered counting, I'm guessing your code somehow doesn't carefully maintain sync on the samples you read from the tasks to produce your X2 sum. If the encoder is in motion when the app starts, you could get an initial offset error in your sum result. The way you read samples from their buffers could also lead to errors in your sums.
Your specific symptom -- counts always decrementing, but only in buffered mode -- is puzzling though. I wouldn't expect that kind of symptom. The buffered tasks don't generally act differently than unbuffered tasks. The only other thought is wondering if some other part of your code does things with the DIO. The B and /B signals must be wired into digital lines if I remember correctly. Isn't it either DIO 5 and 6 or else 6 and 7? Are you doing any DIO?
-Kevin P.
07-16-2008 10:41 AM - edited 07-16-2008 10:41 AM
07-16-2008 11:20 AM
07-17-2008 05:42 AM