bitwise operator. Book query.

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
sysavm
Posts: 13
Joined: 09 Jun 2014 13:19

bitwise operator. Book query.

#1 Post by sysavm » 10 Jun 2014 12:12

http://www.mikroe.com/chapters/view/15/ ... ntrollers/

Is there an error in the BITWISE OPERATORS section of the book above?

<< Shift left a = b << 2 b = 11110011 a = 11001100 // this is ok.
>> Shift right a = b >> 2 b = 11110011 a = 00011110 // this is what i mean.

it should be 00111100, right?

Megahurts
Posts: 900
Joined: 01 Oct 2009 22:48
Location: Rocky Mountains, USA.

Re: bitwise operator. Book query.

#2 Post by Megahurts » 23 Jun 2014 23:50

Hi sysavm,

Your result is correct, document is wrong.

If you do not have or know about BitCalc tool, you should get it so you can check operations like this while you are programming code.
It is a free tool designed for seeing results of any Boolean logic bit operations on a single value or results with one acting on the other
like when doing bit masking operations. It really helps to make sure you are using correct mask values and the right operation to get the end result you wanted.

It is available for download at the LibStock site and made by aCkO (Aleksandar).
It can be added to any mE compilers external tool list for easy access while programming.

Many usage features built in that are of great help to get the right values or operators to use to get the right results with bit logic operators.

Happy Programming :D Robert.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|

SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|

sysavm
Posts: 13
Joined: 09 Jun 2014 13:19

Re: bitwise operator. Book query.

#3 Post by sysavm » 20 Jul 2014 08:27

Thank you Robert.

Post Reply

Return to “Website & Forums General Discussion”