Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

BCD to Gray Code Converter

  1. May 9, 2015 #1
    Having a bit of trouble understanding why there are two different truth tables for BCD to Gray.

    Using ABCD as the BCD and WXYZ as the Gray,
    The way I learned it is:
    1) MSB of BCD (A) = MSB of Gray (W)
    2) A ⊕ B = X
    3) B ⊕ C = Y
    4) C ⊕ D = Z
    5) Since BCD only ranges from 0 - 9, 10 - 15 become "don't cares"

    Following the rules, chart prints:
    http://i.imgur.com/IPsPoAS.png

    However, while browsing through examples of converting BCD to Gray, I found these:
    Example Problem
    Example Problem 2

    The rules I posted don't work in the Example Problems.

    Are there some sort of exceptions that may alter the Gray Code?
     
    Last edited: May 9, 2015
  2. jcsd
  3. May 9, 2015 #2

    Hesch

    User Avatar
    Gold Member

    There are at least 3 different BCD-codes:

    BCD-Codes.jpg

    Maybe that's the cause to confusion?

    But why not choose the one you like, practise some Karnough mapping and make your own truth table ?

    Observe: BCD4221(5) is wrong: It must be 1001 or 0111
     
    Last edited: May 9, 2015
  4. May 9, 2015 #3
    Thanks for the reply,

    The problem I'm facing requires me to,
    "implement a BCD to Gray Code converter using a 4x16x4 PAL where each output collects 4 different product terms."

    I completed the problem using the 8421 BCD code to Gray, but the solutions solved it the way shown here: Example Problem
    Would using the 8421 BCD to Gray functions where
    W = A
    X = A'B
    Y = A'BC' + B'C
    Z = A'BC'D + B'C'D + AD + BCD + B'CD'

    be considered correct in this problem still? I'm skeptical regarding my answer since the question requested "output collects 4 different product terms." I'm assuming that part just means the OR gates in the PAL needs to collect 4 connections from the AND gates.
     
    Last edited: May 9, 2015
  5. May 10, 2015 #4

    Hesch

    User Avatar
    Gold Member

    The rules here:
    matches the BCD and gray-codes here:

    IPsPoAS.png

    In your examples in #1, there are other gray-codes, and of course your rules will not match these.

    For example, how have you found: Z = A'BC'D + B'C'D + AD + BCD + B'CD' in #3 ? That's not right.
     
  6. May 10, 2015 #5
    Yeah that's not right.
    Re-did the K-Map and found Z = A'C'D + B'C'D + A'CD'

    But how would you solve the problem in the example using their BCD-Gray Code instead of the 8421 choice?
    Certainly the rules will not work in that.
     
  7. May 10, 2015 #6

    Hesch

    User Avatar
    Gold Member

    I cannot find out what you are doing. Which BCD-code and which gray-code ar you using?

    As for the BCD- and gray-codes shown in #4, the result is:

    Z = C ⊕ D = ( C * !D ) + ( !C * D )

    ( ! means "not" )
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: BCD to Gray Code Converter
  1. Converting stresses (Replies: 3)

  2. Capacitor Codes (Replies: 2)

Loading...