PDA

View Full Version : Logical difference between 2 8-bit ports XOR?



circuitpro
- 23rd July 2010, 03:21
I'm trying to use XOR, and don't get it. I want an 8-bit binary number showing the difference between two 8-bit ports.... i.e. port X reads one thing, port Y reads another thing, how are they different. How do you do it, because this does not work...


I2CREAD SDA1,SCL1,DJAM,[X]
X=X^%11111111

I2CREAD SDA1,SCL1,IRS,[Y]
Y=Y^%11111111

Z= (X XOR Y)

DEBUG BIN8 Z,10,13

The ports are different, but this returns all 1's.

Thanks!

Darrel Taylor
- 23rd July 2010, 03:53
Z= (X XOR Y)
The ports are different, but this returns all 1's.

XOR is a "Logical operator", same as (^^).

To find the "bitwise" difference, you'll need the "bitwise" operator (^).
Just like in your previous statements ...

X=X^%11111111

Y=Y^%11111111

circuitpro
- 23rd July 2010, 04:17
talk about having the answer and not knowing it. Thanks. :confused: