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

Hi Tommoh,

thnaks.

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

cheers

>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: