At 01:29 PM 29/11/1998 +1300, Seth Fischer wrote: >What does it mean to rotate a file _through the carry bit_ (RLF and >RRF)? > >When executing RLF on portB (8 LEDs) I get this: > >portB = 00000001 > RLF portb >portB = 00000011 ; I want only one bit high and 'walking' left > RLF portB >portB = 00000110 > RLF portB >portB = 00001100 > >What is happening? > >-- >Seth Fischer >Auckland, New Zealand > > You rotate through carry: E.g.;: 1101 0101 (carry e.g.; =0 - you probably dont know) rlf = 1010 1010 - lat zero comes from carry! (carry now = former bit7 = 1) rlf = 0101 0101 - last 1 comes from carry! (carry again =1 ) When you start operation, carry may or may not be set. Correct (secure) way is therefore: clrf PORTB bcf STATUS,C bsf PORTB,0 then: rlf etc best regards, Hans -- Temperature Technology 263 Gilbert Street ADELAIDE SA 5000 web page: http://dove.net.au/~ttec email: ttec@dove.net.au --