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?
bitwise operator. Book query.
Re: bitwise operator. Book query.
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 Robert.
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 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|
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|