BTW, you realise that after 8 shifts, temp_var = 11111111 and the 0 will be in C ? If you want 11111101 11111110 01111111 10111111 without 11111111 in the middle, you'll have use a more complicated loop testing C=0, eg include a skpc or skpnc conditional branch after RRF TEMP_VAR,W if you don't want 11111111 ever to be in TEMP_VAR whilst looping As for your problem, are interrupts on or something ? If TEMP_VAR is being sent to a port (or especially if you're attempting to rotate the port register itself), watch out for r-m-w, and use a shadow register instead -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist