Binary assignment syntax - confused?


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Code:
         Bit #  76543210
    TRISIO =   %01010101
    if you want to set few bits without altering the other, you may need to set them manually one after the other or use bitwise OR.

    let's say you want to change bit 0,2,4,6 of OPTION_REG which you already set to %00000000, then all you need to do is to use
    OPTION_REG=OPTION_REG | %01010101

    You can refer to section 4.17 and see the following
    http://www.learn-c.com/boolean.htm

    HTH
    Last edited by mister_e; - 11th November 2007 at 02:24.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. PIC16F628 - Convert Binary to BCD?
    By steng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th March 2009, 08:17
  2. help required regarding reading binary files
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th March 2008, 22:30
  3. Math operations & Syntax?
    By kevj in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 23rd February 2008, 01:40
  4. Serial reading of binary at 75 baud
    By JasonMarsh in forum Serial
    Replies: 5
    Last Post: - 20th February 2008, 16:36
  5. Decimal to binary conversion
    By Demon in forum Code Examples
    Replies: 9
    Last Post: - 25th February 2005, 20:05

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