ardhuru
- 2nd February 2015, 16:11
Hi, need some help, guys!
I need to set a port to a certain value, depending on another variable which will have only 1 of 2 possible values, 0 or 255.
For example, if the variable is 0, the port should output 45; if the variable is 255, the port should output its complement, 210.
Now, I expected an XOR'ing of the 2 values to give the following results:
0 XOR 45 = 45
255 XOR 45 = 210
However, what I get are pretty random results.
I have tried both operators (XOR as well as ^), with no luck.
Any idea what's happening?
I need to set a port to a certain value, depending on another variable which will have only 1 of 2 possible values, 0 or 255.
For example, if the variable is 0, the port should output 45; if the variable is 255, the port should output its complement, 210.
Now, I expected an XOR'ing of the 2 values to give the following results:
0 XOR 45 = 45
255 XOR 45 = 210
However, what I get are pretty random results.
I have tried both operators (XOR as well as ^), with no luck.
Any idea what's happening?