Tony Ignore that last reply, the code worked tanks alot. apparently portA can't be rotated. Scott Tony Nixon wrote: > Scott wrote: > > > > I want to use portA to read two switches for one project and four > > switches for another. How do I make each bit rotate through the carry > > flag consecutivly. I have been using the following code, but it only > > reads the first bit. I am using a 16c56 > > > > movlw 0x0F > > tris PORTA > > movlw 0x00 > > tris PORTB > > > > input bcf STATUS, C > > rrf PORTA, W > > btfsc STATUS, C > > goto code_1 > > rrf PORTA, W > > btfsc STATUS, C > > goto code_2 > > goto input > > > > I was able to write the rest of this program and simulate it with > > success and I have been stareing at this part for four hours with no > > luck. > > > > Scott > > Try this > > input movf portA,w > movwf Temp > rrf Temp > btfsc status,C > goto code_1 > rrf Temp > btfsc status,C > goto code_2 > > etc.... > goto input > > You don't need to preclear the carry bit because it will be overwritten > on the first rrf instruction anyway. > > -- > Best regards > > Tony > > http://www.picnpoke.com > Email sales@picnpoke.com