How do I check (or set) a group of consecutive bits within a byte?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: How do I check (or set) a group of consecutive bits within a byte?

    Hank, does PBP allow you to XOR a bit?

    Code:
    adcon0.2 = adcon0.2 XOR 1
    

    That's pretty much how I would do it BoostC ( adcon0.2 ^= 1 ).

    Cheerful regards, Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,117


    Did you find this post helpful? Yes | No

    Default Re: How do I check (or set) a group of consecutive bits within a byte?

    This adcon0.2 = adcon0.2 XOR 1 does a logical XOR.

    You need bitwise XOR:

    adcon0.2 = adcon0.2 ^ 1

    Ioannis

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