# 9 bit binary to BCD number

1. ## 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

•

2. ## 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.

•

3. ## Re: 9 bit binary to BCD number

Hi,

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

•

4. ## 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. ## 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.

--[[ ]]--