At 11:58 PM 3/03/97 -0800, you wrote: >That is somewhat similar to what I did more than a decade ago. I used a >couple of one-shots that were re-triggered by the encoder edges. Along with >a flip flop or two it prevented the false triggering as the encoder vibrated >back and forth around one edge. As I recall the time period of the oneshot >was set to less than the maximum encoder rate. The idea came out of EDN (I >think). This was in late 1983. I really do wish I still had that circuit. I designed(but never implemented) something similar in software. I had to sense a digital signal on a port B line with the change on Port B interrupt enabled and have a timer going at the same time for PWM. Jitter on the digital signal was not important but constant interrupts could disrupt the PWM. So on each change of digital signal, I disabled the Port B interrupt and enabled it on the next timer interrupt. The application was a DCC decoder in a model train(yes, that's all I do) which senses the DCC signal on the track and controls the motor speed at the same time using PWM. A dirty track can produce jitter inside the loco. You may lose the data packet but that's OK. It could disrupt the PWM which will manifest itself as the loco shuddering when it hits the dirty patch. Something similar could probably be used for the encoders. Handle jitter by shutting off the Port B interrupt for a while. This ensures that you have enough quiet time to do other processing. You would not lose resolution as the change is still sensed, only at a slower rate. You would not accumulate error because this time period is not long enough to miss an actual step. Regards Prashant --------------------------------+--------------------------------- Prashant Bhandary | Tel: +61-2-9662 5299 Spatial Information Solutions | Fax: +61-2-9662 5348 Roads and Traffic Authority | Email: prashb@rta.nsw.gov.au Rosebery NSW 2018, AUSTRALIA | "2b|!2b" - William Shakespeare --------------------------------+---------------------------------