> -----Original Message----- > From: Simon-Thijs de Feber [SMTP:stdf23173@YAHOO.CO.UK] > Sent: Thursday, January 04, 2001 1:44 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [EE]: Rotary Encoder > > Hello All, > > > i'd like to connect a rotary encoder to a 16F84. > I know i can use the RB4-7 inputs (interrupt on > change), but my bournce rotary encoder has different > behaviour than expected. > > Between 2 dents (clicks) it goes through the following > bit pattern : > > Output A 0 1 1 0 0 > Output B 0 0 1 1 0 > > where in the A= 0 and B= 0 are the in rest positions. > > Is my pic at 10MHZ hast enough to capture this > pattern, count and put some I2C on other pins ??? > > How do i capture the pattern anyway (without > disturbance/bounce and etc) ???? > > > best regards, > > Simon > This is know as a quadrature decoder. There have been hundreds if not thousands of posts on this topic on the piclist, so a search of the archives would be good idea. Then get yourself to http://www.piclist.com/techref/microchip/qenc.htm There are several ways you can decode this type of controller, either through polling or via external interupts. A 10MHz PIC will easily be able to poll a quadrature decoder with plenty of time left over if this decoder is being turned by hand. If this is on the output of e.g. a motor (unlikely if it has dentents) you obviously need to poll the switch more quickly in order to avoid lost states. Regards Mike -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.