Thread: Bit setting

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    13

    Bit setting

    Hi i'm tryng to light two lights on bit addresses 0x0001 and 0x8000 on port two at the same time on a microcontroller......i was just wondering how i'd go about doing that. In order to light the two leds would i have to call address 0x8001 thats 0x0001 and 0x8000 added together.....or do something else? any help would be appreciated thanks

  2. #2
    root
    Join Date
    Sep 2003
    Posts
    232
    >would i have to call address 0x8001 thats 0x0001 and 0x8000 added together.....
    Have you tried it? Did it work? This sounds like something that could easily be discovered with a little quick test program.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    valuetosend = bitvalueone | bitvaluetwo;

    Then just send 'valuetosend'. As stated, a lot of problems can be handled by testing them in a simple test case. Example:

    printf("Set 1, 2 and 4: %d", 1 | 2 | 4 );

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. porting application from 32 bit to 64 bit error
    By gandalf_bar in forum Linux Programming
    Replies: 1
    Last Post: 09-14-2005, 09:20 AM
  2. Bit processing in C
    By eliomancini in forum C Programming
    Replies: 8
    Last Post: 06-07-2005, 10:54 AM
  3. Porting from 32 bit machine to 64 bit machine!
    By anoopks in forum C Programming
    Replies: 10
    Last Post: 02-25-2005, 08:02 PM
  4. Bit Manipulation Questions
    By CPPNewbie in forum C++ Programming
    Replies: 7
    Last Post: 08-12-2003, 02:17 PM
  5. Your favourite fantasy game setting?
    By fry in forum Game Programming
    Replies: 4
    Last Post: 10-16-2002, 06:26 AM