Read back a a few days in the archive you will find a thread called "BTFSS help" I think it is very similar for what you want to do. Basically, you copy the content of PortD to a Temp reg. RRF Temp so many times as shown in PIN. Test bit 0 or Carry, depending on your rotation amount. Quentin