Electronics Forums > Query about Bitwise operations

Junior Member
Join Date: Oct 2011
Posts: 12

 11-14-2011, 08:23 PM
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?

Super Moderator
Join Date: Nov 2011
Location: Germany
Posts: 3,070

 11-18-2011, 12:33 PM
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

Junior Member
Join Date: Oct 2011
Posts: 12

 11-21-2011, 09:29 PM
Thanks for the info Harald, much appreciated.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post IrJoWo99 Electronics Repair 5 04-25-2013 03:08 AM quantumtangles General Electronics Chat 6 04-23-2013 07:50 PM lotec General Electronics Chat 7 04-16-2013 12:09 AM cafm Electronic Design 0 11-27-2005 09:00 AM Michael Grigoni Electronic Equipment 0 05-25-2004 03:37 AM