Logical difference between 2 8-bit ports XOR?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default Logical difference between 2 8-bit ports XOR?

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

    Code:
         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!
    Last edited by circuitpro; - 23rd July 2010 at 03:27.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by circuitpro View Post
    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
    DT

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    talk about having the answer and not knowing it. Thanks.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts