Hi Ioannis,
Here I made it clear to see.
But, as you said, it should not provide 0000.
Code:
Ignore high nibble on Portb. PORTB is just an example here.
.
.
i=240 to 250 11110000 11110001 11110010 11110011 11110100 11110101 11110110 11110111 11111000 11111001 11111010
PORTB (example) 11110000 11110001 11110011 11110111 11111111 11111110 11111100 11111000 11111010 11110101 11111101
Temp=PORTB 11110000 11110001 11110011 11110111 11111111 11111110 11111100 11111000 11111010 11110101 11111101
PORTB=Temp & i 11110000 11110001 11110010 11110011 11110100 11110100 11110100 11110000 11111000 11110001 11111000
.
.
.
Note:
The & (bitwise AND) operator compares each bit of its first operand to the corresponding bit of the second operand. If both bits are 1's, the corresponding bit of the result is set to 1. Otherwise, it sets the corresponding result bit to 0.
---------------------------
Last edited by sayzer; - 18th October 2006 at 12:14.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks