> I know that there was some traffic concerning encoders earlier....but at > the time I wasn't interested in them. Now I am, and I feel a bit guilty > because this may be old news to others. > > The encoder I've got has an A pin and a B pin. I've noticed on the > scope that one pulse train will lead the other depending on the > direction of rotation (CW vs. CCW). During a power up state there could > be one of four conditions (two bits, A and B, thus four possible > states). I'm beginning to write my block diagram for the code (intended > for a PIC16C84) and it's getting pretty messy with all the decision > loops. > > * I first check which state the encoder is in. > * Then determine which direction it is rotating. > * Each degree of motion will be put into a register that is either > incremented or decremented depending on direction. > > So if you are not sick of discussing encoder applications with the PIC I > would love to hear what other people have done....advice, best > practices, code snippets, etc. > > Thanks, > Pete > peter.cesarz@appl.ge.com > I just feed one signal into portb,0 interrupt. When the interrupt occurs I check the state of the other signal, if its high increment the angle register and if low decrement it. Or vice versa depending on the required direction. Paul Waterfield Exhibit designer Techniquest Stuart Street Cardiff CF1 6BW UK T +44 (0) 1222 475 475 F +44 (0) 1222 482 517