0

Hi There,

I have a piece of code that is confusing me and would appreciate any advice:

Reg1 is an 8 bit register
Bit0 is bit 0 of Reg1

Line of code that I am having trouble understanding:
Reg1 &= ~(1<<Bit0);


This is what I think the answer is:

Asume that Reg1 = 00h initially

If Bit0 = 0
then Reg1 = 00h

If Bit1 = 1
then Reg1 = 01h

Does this make sense?

Cheers

4
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by ballinloughan
0

Hi Tommoh,

thnaks.

What happens if Reg1 = 00000001 and Bit0 = 1 initially ??

cheers

0

>What happens if Reg1 = 00000001 and Bit0 = 1 initially ??
What do you think? Run through the same process and see what you can figure out. After all, it won't do for someone else to hold your hand through figuring out every combination of values you can think of. :icon_rolleyes:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.