Hi,
I'm trying to "AND" the contents of a register with values from 0 - 255. I'm not sure how to approach this. Here is what I have so far:
I don't know what the contents of the top 3 bits are on PORTB, and I don't want to change them. I don't think my code will work, however, cause PORTB is not a literal. I could move the value of PORTB into W, but how do I do that? Does "movf PORTB" work without chopping the MSB off?
Thanks!
I'm trying to "AND" the contents of a register with values from 0 - 255. I'm not sure how to approach this. Here is what I have so far:
Code:
movlw b'11100001'
andlw PORTB
movlw PORTB
I don't know what the contents of the top 3 bits are on PORTB, and I don't want to change them. I don't think my code will work, however, cause PORTB is not a literal. I could move the value of PORTB into W, but how do I do that? Does "movf PORTB" work without chopping the MSB off?
Thanks!