Scott wrote: > > It seems to be working pretty well now, however when I use the rlf instruction > the data is rolled into the high nibble of the variable temp and the carry nev er > sees is. How can I make the temp variable four bits wide? Thanks for havin g > mercy on such a newbi. I think someone sneezed on the wafer before they cut it up and wrapped the bits in prickly plastic. It's given your chip an extra instruction :-) The carry is always changed after a 'rrf' or rlf' instruction. It may not appear to get changed, because the new data bit may be the same as the old. if PortA = 00000010, then movf porta,w movwf temp temp = 00000010 carry could be 0 or 1 - it doesn't matter rrf temp temp = 00000001 - [note: bit 7 is the original carry bit value and could be 1] carry = 0 - carry = original value of temp bit 0 carry = 0 -> key #1 not pressed, loop back and rotate again rrf temp temp = 00000000 - bit 7 = the carry bit value carry = 1 - carry = original value of temp bit 0 carry = 1 -> key #2 is pressed, service the key routine Just looking over your message again, you mentioned "rlf" not "rrf". If you changed this by accident that could be causing your problem. Try using 55h or 0xAA in a register and rotate that left or right to see the effect on the register and the carry bit. -- Best regards Tony http://www.picnpoke.com Email sales@picnpoke.com