That does indeed half the resolution. Connect each channel to an interrupt on change pin. In the interrupt routine compare the present value of both channels with the value before the interrupt. The function is messy and is most easily dealt with by a sixteen entry look up table which returns +1 or -1 for genuine movement and 0 for spurious values caused by bounce. On 17 January 2014 19:34, Jon Hulatt wrote: > > On 17 Jan 2014, at 19:01, Sergey Dryga wrote: > > > You can use only 1 interrupt, and look at the state of the other pin. > > Example: interrupt on L channel, then check R channel. If R is high, > then > > increment count, if R is low - decrement. > > If I understand your suggestion correctly then surely that halves the > resolution of my counter? It only adjusts the counter when channel A > changes state, whereas the dual interrupt solution gets a count every sta= te > change. > > Of course, if your code is less cycles then i could use an encoder with > double the output rate. > > > You might need debouncing on L > > channel (or inhibit subsequent interrupt for some time), but not on R > > channel since the channels are 90 degrees out of phase, which provides > > sufficient time for the contact to settle. > > I don=92t believe that I need debouncing with the encoder i=92m using > > > thanks for your help! > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 __________________________________________ David C Brown 43 Bings Road Whaley Bridge High Peak Phone: 01663 733236 Derbyshire eMail: dcb.home@gmail.com SK23 7ND web: www.bings-knowle.co.uk/dcb --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .