This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assigning a larger value to a bit

bit           bitVal;
unsigned char byteVal;
:
:
   bitVal = byteVal;
Question:
How does C51 determine whether to set or clear the bit?
Does it:
A). Simply copy the LSB of the byteVal into the bit, or
B). Clear the bit if the byteVal is zero; set it otherwise

ie,
   bitVal = byteVal & 0x01 // Equivalent to A 
or
   bitVal = (byteVal > 0)  // Equivalent to B 

It looks like it does B, and that seems to me to be the most reasonable for an "arithmetic" assignment; but I'd just like to be sure.
I couldn't see it in the manual.