How to convert BCD to Decimal?

Discussion in 'Homework Help' started by Doraemon, May 22, 2015.

  1. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    Converting Decimal to BCD is easy but how do I convert BCD to Decimal when the BCD is like this:

    0111100100100010110 (BCD) = 0011 1100 1001 0001 0110 (grouping into 4 bits from right to left)
    = 3 12 9 1 6 (converted 4bits binary to decimal)
    = 312916 (Final decimal number)


    As you can see I've done as per the method but the answer is wrong (tested on online converter), anyone can help me with this? I'll really appreciate it, I googled and found almost all articles about Decimal to Binary. I've no idea what I'm doing wrong.
     
  2. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Maybe you could pick up the Magical treasures from your pocket and to check the time after the answer you know ... :D

    > = 3 12 9 1 6 (converted 4bits binary to decimal)

    Try to using the hexadecimal to show them and converting to decimal.
     
  3. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    I'm writing my assignment since last 7 hours continuously and came across this problem, I'm completely exhausted right now I have 2 days left to submit my assignment XD, Just asked here if someone can provide a solution and save my time.


    "Try to using the hexadecimal to show them and converting to decimal."

    I don't understand what exactly you're suggesting to do, should I convert those grouped 4 bits to hexadecimal and then convert the hexadecimal to decimal?
     
  4. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    Update: I checked the answer is 3916 but what happens to "12"? Should we ignore the digits larger than 9? I checked the BCD and Decimal table and 12 is represented as 00010010 which is 1 (0001) and 2 (0010) together = 12 (00010010). Any help will be appreciated, I'm really confused right now :(

    Update 2: Found this on one website:
    Invalid BCD Numbers
    These binary numbers are not allowed in the BCD code: 1010, 1011, 1100, 1101, 1110, 1111

    So I guess I need to ignore the 1100. And in exam I need to write it like this:

    0111100100100010110 = 0011(base2) 1100(base2) 1001(base2) 0001(base2) 0110(base2)
    = 3(base10) 9(base10) 1(base10) 6(base10)
    = 3916 (base10)
    Am I correct? :)
     
    Last edited: May 22, 2015
  5. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    How come you missing the "12"?

    You don't know this - Try to using the hexadecimal to show them and converting to decimal.
    I think you need to restudy the hexadecimal if you not study yet.
    Try to answer the hexadecimal to decimal as :
    Code (Text):
    1.  
    2. Hex → Dec
    3. ---------------
    4. 01  →
    5. 06  →
    6. 09  →
    7. 0a  →
    8. 0d  →
    9. 0f  →
    10.  
    11.    Hex  →  Dec
    12. -------------
    13. (01+01) →
    14. (09+09) →
    15. (0f+0f) →
    16.  
    Using the "[" + "code" + "]" "[" + "/" + "code" + "]" function to show the math.
    If you don't know hexadecimal, then google it.
     
  6. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    I fail to see how converting to hexadecimal will help. There are 4 bits which are not a BCD value, whether in binary or hexadecimal. 1100 in binary is the same value as 0C in hex. No matter which way you write it, it's not representative of a decimal digit (BCD).

    Unfortunately, the problem doesn't state what to do with an invalid value. So it's unclear whether you're correct or not.
     
    ScottWang likes this.
  7. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    What do you mean by "convert BCD to decimal"?

    BCD is decimal.
     
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    You break the balloon as exposing the new clothes of King.
     
  9. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    Okay I think I'm familiar with Hexadecimal, I just started learning 3 days ago. Here is the answers:

    Code (Text):
    1.  
    2. Hex → Dec
    3. ---------------
    4. 01  → 0 * 16^1   +  1 * 16 ^0  =  1
    5. 06  → 0 * 16^1  +  6 * 16 ^0  =  6
    6. 09  → 0 * 16^1  +  9 * 16 ^0  =  9
    7. 0a  → 0 * 16^1  +  a * 16 ^0  =   10 * 16 ^0 = 10
    8. 0d  → 0 * 16^1  +  d * 16 ^0  = 13 * 16^0  =  13
    9. 0f  → 0 * 16^1  +  f * 16 ^0   =  15 * 16^0  = 15
    10.  
    11.    Hex  →  Dec
    12. -------------
    13. (01+01) → 1 + 1 = 2
    14. (09+09) → 9 + 9 = 18
    15. (0f+0f) →15 + 15 = 30
    16.  
     
  10. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    That's what I'm trying to figure out what to do with 12 aka 1100 in binary! :confused:

    I belive ScottWang has the answer but he is trying to teach me something I should have known before solving this problem.
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    What you really need to learn is the difference between binary, hexadecimal, decimal and BCD.
     
  12. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
  13. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    What is the difference between the binary representation of a decimal number and the binary representation of a value in BCD?
     
  14. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    Binary representation of decimal number 12 in binary will be 1100
    While 12 will be denoted as 00010010 in BCD, the numbers after 9, which are 2 digits are represented differently. Each digit will be represented in 4 bits, total 8 bits.
     
  15. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    Channelling "Family Fued" (US television game show),
    "Good question! Good question!" (Clapping)
     
  16. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    Your original question ought to be:

    How to convert from binary to BCD?
    along with
    How to convert from BCD to binary?

    Show us how you convert from BCD to binary.

    Note that BCD means binary coded decimal. Which means that it is both binary and decimal at the same time. It is a binary representation of a decimal value.

    0 = 0000
    1 = 0001
    2 = 0010
    3 = 0011
    4 = 0100
    5 = 0101
    6 = 0110
    7 = 0111
    8 = 1000
    9 = 1001

    There are no values greater than 9.
     
  17. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    Make a distinction between the value of a quantity and its representation.
    The quantity twelve can be represented in many ways:

    binary: 1100
    hexadecimal: 0C
    decimal: 12
    BCD: 0001 0010
     
  18. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,526
    2,369
    Also BCD to ASCII add 30 to each digit.
    Max.
     
  19. Doraemon

    Thread Starter New Member

    May 21, 2015
    13
    0
    Okay I'll appreciate it if you can tell me step by step solution of

    0111100100100010110 (BCD) = ?(10)

    The (BCD) and (10) both are written in small letter in subscript (in base).

    That's my question written in my assignment paper :)



    "Show us how you convert from BCD to binary."

    To convert BCD to binary, first I need to convert BCD into decimal and then convert the decimal into binary as far as I know. But the question is what steps should I take to convert BCD into decimal.
     
  20. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    Are you sure that's the question?
    There are only 19 binary digits.
    BCD would imply some multiple of four for the total number of bits
     
    Doraemon likes this.
Loading...