This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

bit shifting

hello there i have some problem regarding the bit shifting i want to convert the some no. from Hex. to Decimal for that i am going to used the shifting. when i recived the no. in hex format then i want to other reg. ex.when i recive 0x3d then i want to move the 3 to other location(or reg) after doing some calculation now i want move the d.with ACC >>(shifting opration is fine but in which way )please help me

Parents
  • LowNibble = Number & 0x0F;
    HighNibble = Number >> 4;

    with this i work for 0xFF,but what happened when my value excedded that "ex. for 0x270f which is equal to 9999 in decimal" what will i do in this case
    here is some way you just told me is it proper or not when i read this value form eeprom it get store in reg. say RDREG to seprate 0x270f first i am going >>8 so i will get 27 after that <<8 i will get 0f is it right

Reply
  • LowNibble = Number & 0x0F;
    HighNibble = Number >> 4;

    with this i work for 0xFF,but what happened when my value excedded that "ex. for 0x270f which is equal to 9999 in decimal" what will i do in this case
    here is some way you just told me is it proper or not when i read this value form eeprom it get store in reg. say RDREG to seprate 0x270f first i am going >>8 so i will get 27 after that <<8 i will get 0f is it right

Children