Re: how create an 8 bit binary to BCD decoder?

Discussion in 'VHDL' started by emirogluengin@gmail.com, May 1, 2014.

  1. Guest

    15 Mayıs 2002 Çarşamba 23:07:03 UTC+3 tarihinde Christian yazdı:
    > Hello!
    > I know this newsgroup is specially ybout VHDL. But I am curently working
    > with Altera's derivation AHDL.
    > My question isn't quite language related but more general:
    >
    > How would you create a decoder which generates BCD-coding from normal 8bit
    > binary coding?
    > I want to control several 7 segment displays and therefore have to use BCD
    > coding.
    >
    > I'd be very happy to get any kind of help.
    > Regards
    > Chris.
     
    , May 1, 2014
    #1
    1. Advertising

  2. rickman Guest

    On 5/1/2014 12:55 PM, wrote:
    > 15 Mayıs 2002 Çarşamba 23:07:03 UTC+3 tarihinde Christian yazdı:
    >> Hello!
    >> I know this newsgroup is specially ybout VHDL. But I am curently working
    >> with Altera's derivation AHDL.
    >> My question isn't quite language related but more general:
    >>
    >> How would you create a decoder which generates BCD-coding from normal 8bit
    >> binary coding?
    >> I want to control several 7 segment displays and therefore have to use BCD
    >> coding.
    >>
    >> I'd be very happy to get any kind of help.
    >> Regards
    >> Chris.


    I see this message has not been answered so let me try.

    I remember seeing some fairly elegant ways to convert binary to decimal,
    but none of them seem to have stuck in my mind. I bet a google search
    would pull up a few.

    In your case I think you could do some fairly simple shortcuts which
    take advantage of the fact that you are only converting an 8 bit sample.
    With larger numbers it is usually done iteratively, converting one
    digit at a time, LSB first.

    --

    Rick
     
    rickman, May 9, 2014
    #2
    1. Advertising

  3. GaborSzakacs Guest

    rickman wrote:
    > On 5/1/2014 12:55 PM, wrote:
    >> 15 Mayıs 2002 Çarşamba 23:07:03 UTC+3 tarihinde Christian yazdı:
    >>> Hello!
    >>> I know this newsgroup is specially ybout VHDL. But I am curently working
    >>> with Altera's derivation AHDL.
    >>> My question isn't quite language related but more general:
    >>>
    >>> How would you create a decoder which generates BCD-coding from normal
    >>> 8bit
    >>> binary coding?
    >>> I want to control several 7 segment displays and therefore have to
    >>> use BCD
    >>> coding.
    >>>
    >>> I'd be very happy to get any kind of help.
    >>> Regards
    >>> Chris.

    >
    > I see this message has not been answered so let me try.
    >
    > I remember seeing some fairly elegant ways to convert binary to decimal,
    > but none of them seem to have stuck in my mind. I bet a google search
    > would pull up a few.
    >
    > In your case I think you could do some fairly simple shortcuts which
    > take advantage of the fact that you are only converting an 8 bit sample.
    > With larger numbers it is usually done iteratively, converting one
    > digit at a time, LSB first.
    >


    When I had to do this with an 8-bit micro, I made use of the DAA
    (decimal adjust after addition) instruction. The basic loop was:

    shift input left into carry
    add accumulator + carry in to accumulator
    decimal adjust accumulator

    The combination of addition and DAA effectively created a BCD
    adder.

    Note that the accumulator must be zeroed out before the loop,
    and you need a loop counter, but that was the basic idea.

    In an FPGA, I'd probably use a lookup table if there were only 8 bits.
    I assume that since this information is going to a display, that you
    have lots of time (many clock cycles) available to get the job done?

    --
    Gabor
     
    GaborSzakacs, May 12, 2014
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fangs
    Replies:
    3
    Views:
    9,885
    darshana
    Oct 26, 2008
  2. Yama
    Replies:
    3
    Views:
    1,362
    Dave Pollum
    Jun 9, 2006
  3. raja_bade
    Replies:
    2
    Views:
    10,905
    raja_bade
    Jul 31, 2008
  4. arthur merlo

    bcd-7segment decoder

    arthur merlo, Jun 15, 2012, in forum: VHDL
    Replies:
    3
    Views:
    1,007
    Paul Uiterlinden
    Jun 18, 2012
  5. wandrade

    8bits to 7segments bcd decoder

    wandrade, Nov 22, 2012, in forum: VHDL
    Replies:
    2
    Views:
    439
Loading...

Share This Page