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 Reply Children
  • No once you shift the data is lost.
    i am doing this all shifting operation by taking(copying) data in to different location.
    actully i am doing the conversion operation from hex to decimal that way i am seprating all these bit after that
    0th bit multiply by 16^0
    1st bit multiply by 16^1
    2nd bit multiply by 16^2
    3th bit multiply by 16^3
    and after that adding all these hoping for the answer

    this one is long,and more complicated way if you are having any another way which is easy to understand and less complicated. please told me

  • nibble1 = multiply by 16^0
    nibble2 = multiply by 16^1
    nibble3 = multiply by 16^2
    nibble4 = multiply by 16^3

  • sorry for above 2 post here you will get the clear view.

    D_1 = nibble1 *16^0
    D_2 = nibble2 *16^1
    D_3 = nibble3 *16^2
    D_4 = nibble4 *16^3

    dec_ans = D_1 + D_2 + D_3 D_4