Change a variable to the opposite?


Results 1 to 11 of 11

Threaded View

  1. #6
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Change a variable to the opposite?

    That is an "exclusive OR" (XOR) with a byte of 00001111. So when you input 00001001, it will return 00000110.

    Here is the truth table on page 79 of the manual.
    Code:
    A    B   A ^ B
    0    0      0
    0    1      1
    1    0      1
    1    1      0
    If only A or only B is 1, then result is 1.
    The ^ operator is commonly used to invert selected bits:
    Last edited by SteveB; - 20th June 2012 at 03:54.

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