I use an interrupt on a change on encoder count pin and inside the ISR I check the quadrature bit to see if I count up or down. Hope this helps Francisco Marty wrote: >Hi All, > >I have just purchased some 2 bit rotary encoders which i'd like to use in my >pic projects (scrolling thru LCD menus etc etc) > >There are 2 output pins, being out of phase by 90degrees (1 leads, 1 lags) >to indicate the direction of rotation. > >Is there some picbasic code to read the direction of the encoder? >I've tried a few things, but it seems to count up,up,up no matter which way >i rotate.....i obviously need more of a bitwise arithmetic to identify the >bits and direction. > >I have seen a cicuit sometime ago, where the rotary encoder 2 bits feed into >some EXOR gates, and then the 2 EXOR outputs would feed an up/down binary >counter (cmos 4000 ic's)...i'm trying to elimintae the cmos, and perhaps >need to do the EXORing inside the pic ???? > >Any help is welcomed. >Marty. (pic 16F84 & 16F877 used here) > > > >--- >Outgoing mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/03 > >-- >http://www.piclist.com hint: PICList Posts must start with ONE topic: >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > >. > > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads