Hi all, I need to shift a 5 bit number in, through and out of a byte using bit0 to bit4 and not affect bit5 - bit7. The best way I can think of an example is if you had two 8 bit wide registers next to each other like the following. The 5 bit value in byte 2 is shifted left throughout byte 1 and out. byte1 byte2 XXX00000 xxx11111 start state XXX00001 xxx11110 XXX00011 xxx11100 XXX00111 xxx11000 XXX01111 xxx10000 XXX11111 xxx00000 XXX11110 xxx00000 XXX11100 xxx00000 XXX11000 xxx00000 XXX10000 xxx00000 XXX00000 xxx00000 end state Only byte 1 is important, byte 2 is just for my example. X = can not be changed. x = not used Anyone have any ideas on how to do this? I think a couple of loops and some bit testing & setting will do it but I just can't seem to crack the algorithm needed. Regards Jean-Michel. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.