On Tue, 19 Oct 1999, Scott wrote: > Tony > > Ignore that last reply, the code worked tanks alot. apparently > portA can't be rotated. Correct. And - besides - if you rotate something into W, the original will remain unchanged. If you repeat, you get the same result again. (That is why Scott's code does not "exactly the same" as Tony's.) Regards, Imre > > 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 > >