#include "reg51.h" main() { bit k; k = ACC^7; //this instruction is right . ACC^7 = 1; // this instruction is wrong! why? } thank you !
So "k = ACC^7;" means take the ACC register, XOR it with 7, then truncate the 8 bit result to one bit and place into k". Actually, I don't think that's correct. In an assignment to a bit type the right hand side is treated as a boolean type, no truncation occurs. Assignment of any non-zero value to a bit variable results in the bit being equal to one. Stefan
You're probably right there Stefan, I was making an assumption. Still, it is not what she was intending I'm sure.