Routine that converts from HEX to BCD

Discussion in 'Homework Help' started by MMattar9, Sep 16, 2013.

  1. MMattar9

    Thread Starter New Member

    Sep 12, 2013

    For my assembly language/ embedded systems class I need to write a routine that converts from Hexadecimal to BCD.

    Can anyone help me out here with the code for how to do this?

    Please state any limitations also!

  2. t06afre

    AAC Fanatic!

    May 11, 2009
    Well I see a few limitations. First of all we will not do your homework for you. Second we do not have any idea what kind of assembler you are using in your class:p
    To get out of this awkward back eddy why not post your current work and also write some words about why and how you struggle. Then I am sure somebody will help you
    ErnieM likes this.
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    What have you got so far? You need to make an attempt, as this is homework and deserves to be in homework help....

    Knowing the processor might also help! :)

    What are the steps to converting from binary to BCD?
  4. WBahn


    Mar 31, 2012
    This should definitely be over in Homework Help -- you might get more assistance over there if it were. But don't start a new post over there. You might ask a mod to move it (or we can bring it to their attention if you want) or they might move it on their own.

    Start with a toy example on paper. You have the value 0x0C and you want to convert that to 0x12. How would you do it by hand? Next consider how you would convert 0xAB to 0x171. Then how you would convert 0xFF to 0x255.

    There are patterns that develop that you can use to develop an algorithm.
  5. mitko89


    Sep 20, 2012
    This problem is discussed in at least few threads, try searching a bit...