Nov 27, 2011 #1 B bimalkamal Member level 1 Joined Nov 27, 2011 Messages 32 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 1,529 Suppose my PORTB register contains decimal 128(Hex0x80) now in a loop the value must change like:- 128->64->32->16->8->4->2->1 Divide by 2 or shift left operation is needed.what to do? RRF PORTB,1 instruction changes like this:- (Bits shown) 10000000->11000000->11100000->11110000->11111000->.....->11111111 so, it is not what I want
Suppose my PORTB register contains decimal 128(Hex0x80) now in a loop the value must change like:- 128->64->32->16->8->4->2->1 Divide by 2 or shift left operation is needed.what to do? RRF PORTB,1 instruction changes like this:- (Bits shown) 10000000->11000000->11100000->11110000->11111000->.....->11111111 so, it is not what I want
Nov 27, 2011 #2 cubanflyer Full Member level 5 Joined Jul 31, 2010 Messages 255 Helped 75 Reputation 152 Reaction score 71 Trophy points 1,308 Location UK Activity points 2,500 Clear the carry bit before you do the each RRF instruction.