Digital Logic help!!

Discussion in 'General Electronics Chat' started by Mark200, May 22, 2009.

  1. Mark200

    Thread Starter New Member

    May 22, 2009
    1
    0
    Ok so I have an exam tomorrow in Digital Logic and I really need a bit of help. I'm looking through a few past exam papers, and I think if I get general solutions to the following questions then I should be ok:

    1) What is the difference between a 4-bit binary integer and a 5-bit binary coded decimal (BCD) integer? The book doesn't seem to mention it. The example given in the question is:

    Binary integer 1100 converts to the BCD integer 10010

    2) I'll just give an example question:
    Ok so I know how to convert a transition table into a primitive flow table... but I don't understand how you can get a transition table from the information given. I always thought that a transition table showed the change from one state to another..?


    3) I'll give another example question:
    Again, I think I'm just getting confused with transition tables here...


    So yeah if I could get any help on any of the above examples I'd appreciate it a lot!!
     
  2. studiot

    AAC Fanatic!

    Nov 9, 2007
    5,005
    513
    Are you sure you have the 4 and 5 the correct way round?

    A binary integer represents a number (in binary or base2)

    A BCD code represents a character, not a number.

    4 bits allow up to 16 characters - all the numbers from 0 - 15 say so can represent all the decimal characters with a few to spare.

    The original ASCII code was 5 bits long.

    You could print out the summaries in this excellent thread

    http://forum.allaboutcircuits.com/showthread.php?t=3560
     
  3. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    "A BCD code represents a character, not a number."
    BCD = Binary Coded Decimal. Anyway, characters, to computers, are numbers. e.g., 0x41 == 'A' in ASCII. We interpret what the numbers mean.

    To go from Bin to BCD, I convert the binary to decimal, then convert each digit to binary. There's probably a formula for doing it, but this works for me.

    10111b == 23d == 10 0011 BCD

    --Rich
     
  4. studiot

    AAC Fanatic!

    Nov 9, 2007
    5,005
    513
    Well in my book

    the decimal number 14 is coded 1110 in binary and 0001 0100 in binary coded decimal.

    These are clearly not the same and the question did ask for the difference.

    Now let us try the sums 14 + 7 = 21

    1110 + 0111 = 10101

    1110
    0111
    10101

    Which is fine in binary


    0001 0100 + 0000 0111 = 0001 1011

    which is nothing like 21 in either binary or BCD

    But of course that is because we these are representations of characters which need special rules to add.
     
    Last edited: May 22, 2009
  5. studiot

    AAC Fanatic!

    Nov 9, 2007
    5,005
    513
    Perhaps I should also post the special rules to add in BCD.

    Since the coding was chosen such that the numerals 0 through 9 are represented by codes identical their binary values addition of codes is the same as addition of numbers so long as the result does not exceed 9.

    If the result exceeds 9 then in binary we have codes that have no equivalent in BCD.

    We get over this by noting there are 6 unused codes (for 10,11,12,13,14 &15) so if we add 6 in binary we skip to the next placeholder. We need to do this whenever there is a carry.

    It's actually easier to do than say so here is my example

    0000 0111 (7)
    0001 0100 (14)
    0001 1011 which is not 21 in BCD
    0000 0110 add 6 since there was a carry
    0010 0001 which is BCD for 21
     
Loading...