+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Member level 3
    Points: 286, Level: 3

    Join Date
    Apr 2013
    Posts
    60
    Helped
    0 / 0
    Points
    286
    Level
    3

    9 bit binary to BCD number

    Hi,

    I need to develop a VHDL code for 9 bit binary to BCD number.

    I searched in internet and find code for converting 8 bit and 10 bit numbers

    Can anyone help me in writing the code for this 9 bit binary number
    Last edited by xilinx1001; 3rd May 2013 at 11:33.

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 260,308, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,460
    Helped
    13829 / 13829
    Points
    260,308
    Level
    100

    Re: 9 bit binary to BCD number

    I searched in internet and find code for converting 8 bit and 10 bit numbers
    So you got the answer, isn't it? I presume you know how to delete lines of code.



    •   AltAdvertisement

        
       

  3. #3
    Member level 3
    Points: 286, Level: 3

    Join Date
    Apr 2013
    Posts
    60
    Helped
    0 / 0
    Points
    286
    Level
    3

    Re: 9 bit binary to BCD number

    Hi,

    Thanks for your reply

    Can I use this 10 bit binary number conversion here for 9 bit

    I think for 10 bit binary conversion, it will shift 10 times

    Can I use that here



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 260,308, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,460
    Helped
    13829 / 13829
    Points
    260,308
    Level
    100

    Re: 9 bit binary to BCD number

    It will do more than just shift. See http://en.wikipedia.org/wiki/Double_dabble

    But basically, you'll save one shift when reducing from 10 to 9 bit. And you get only 3 output nibbles.



  5. #5
    Member level 4
    Points: 628, Level: 5

    Join Date
    Mar 2012
    Posts
    75
    Helped
    7 / 7
    Points
    628
    Level
    5

    Re: 9 bit binary to BCD number

    You can use a case state on the binary number, generally looks like:

    case (bin_num)

    0000 : seven_seg = 1111
    0001 : seven_seg = 0101
    ...
    1111: ...

    where seven_seg is a variable holding 0/1 for each bit of 7 seg outputs.



--[[ ]]--