Query about Bitwise operations

Discussion in 'Microcontrollers and Programming' started by alsaf, Nov 14, 2011.

  1. alsaf

    alsaf

    Joined:
    Oct 2, 2011
    Messages:
    12
    I had come heard of Bitwise but I didn't really understood it until recently when I had being learning Assembly language programming. While I understood its principles and how it worked, I didn't really know what purpose it was for. From research the some purposes are bit fields/flags and arithmetic.

    I would assume, in terms of embedded programming, using bitwise operations for arithmetic purposes would be better than built-in ones when doing heavy number crunching operations but would it be beneficial or even noticeable if any occasional calculations were required?
     
    alsaf, Nov 14, 2011
    #1
    1. Advertising

  2. alsaf

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    4,255
    Hi alsaf,
    bitwise operations are not for arithmetic purposes, although one could use them in that way.

    There are several uses for bitwise operations. Just afe to mention:
    1) store lot of data with little memory. E.g. ona an 8 Bit computer, an 8 bit data word could be used to store the presence or absence of 8 different properties. Bit n=1 could mean property "n" is present, Bit n=0 could mean property "n" is missing. To set, clear and check single bits, you need bitwise operations. In this example you need only 1 data word instead of 8 words to store this infiormation.
    2) set, clear and check single port bits of a microcontroller. A microcontrollers I/Os are very often grouped in words of 8, 16 or 32 bits. You need bitwise operations e.g. to set a singel I/O line to high or low or to check its status.

    You will find more usefull information especially on bitwise operations in maicrocontroller manuals.

    Regards,

    Harald
     
    Harald Kapp, Nov 18, 2011
    #2
    1. Advertising

  3. alsaf

    alsaf

    Joined:
    Oct 2, 2011
    Messages:
    12
    Thanks for the info Harald, much appreciated.
     
    alsaf, Nov 21, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Thompson

    Motorola To Spin Off Remaining Semiconductor Operations

    Jim Thompson, Oct 12, 2003, in forum: Electronic Design
    Replies:
    10
    Views:
    401
    Spehro Pefhany
    Oct 13, 2003
  2. Jim Thompson
    Replies:
    10
    Views:
    581
    Spehro Pefhany
    Oct 13, 2003
  3. Rich Grise
    Replies:
    6
    Views:
    950
    Gary H. Lucas
    Jun 24, 2005
  4. cafm

    Wireless BitWise Bus Arbitration

    cafm, Nov 27, 2005, in forum: Electronic Design
    Replies:
    0
    Views:
    331
  5. Michael Grigoni
    Replies:
    0
    Views:
    495
    Michael Grigoni
    May 25, 2004
Loading...

Share This Page