On Mon, 6 Oct 2003 11:34:39 +0200, you wrote: >jumanji wrote : > >> Actually I meant something like: "one 'set' bit that rotates over 2 = bytes" > >OK. Doesn't change much. So you startup by putting >15 zeros and 1 one in the two bytes in some initialization >routine and then rotate all bits, right ? >The rotate code below dosn't care what's in the bytes, of course, >but rotating 16 zeros or 16 ones would be hard to debug :-) > >Jan-Erik. >PS. >It should aso be said that you use the 18-series, >on the 16-series you should use RLF instead of RLCF... > > >> To rotate *all* bits in two bytes left : >> (bit 7 of byte 2 goes into bit 0 of byte 1 and >> bit 7 of byte 1 goes int0 byte 0 of byte 2) >> bsf status, c ;Setup carry flag... >> btfss byte2,7 ;...according to bit 7 >> bcf status, c ;...of byte 2 >> rlcf byte1 ;rotate carry into byte 1 >> rlcf byte2 ;same for byte 2 >> >> Jan-Erik. It's even easier than that if you don;t need to preserve W :=20 (16Cxx code):=20 rlf byte2,w ; carry from bit 7 rlf byte1 rlf byte2 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.