Breaking News
Comments
Newest First | Oldest First | Threaded View
Max The Magnificent
User Rank
Blogger
Re: How to convert BCD to Gray Code using sequential circuirt
Max The Magnificent   2/17/2014 11:04:35 AM
NO RATINGS
@BSc Student: i am a bit stuck on how to derive the state map for the conversion which i would then use to design the sequeantial circuit.

I think there are two things here. let's say you have four registers that are used to hole your BCD count. Let's call them b3, b2, b1, and b0. So the first thing you need is a block of combinatorial logic in the feedback path to generate the next BCD value in the count sequence.

That is, you take the outputs from b3, b2, b1, and b0, feed them into your block of logic, and use the outputs from this logic to drive the inputs to your registers, so every time you get a clock pulse the BCD counter counts.

The next thing you need is another block of combinatorial logic that takes the outputs from the b3, b2, b1, and b0 registers and generates your 4-bit Gray code -- let's call these bits g3, g2, g1, and g0.

Take a look at my table -- let's start with g0. The only times this is a 1 corresponds to the BCD states of 1, 2, 7, and 8 (0001, 0010, 0111, and 1000). So we can say:

g0 = (!b3 & !b2 & !b1 & b0) | (!b3 & !b2 & b1 &!b0) | (!b3 & b2 &b1 & b0) | (b3 & !b2 & !b1 & !b0);

We would do the same thing for the other three Gray code bits (and we'd use the same technique to generate the next count value for the BCD feedback path).

Then use standard logic minimization techniques (like Karnaugh maps) to make the logic as small as possible.

I hope this helps. Let me know how you get on. Happy Monday! :-)

 

BSc Student
User Rank
Rookie
Re: How to convert BCD to Gray Code using sequential circuirt
BSc Student   2/16/2014 5:55:28 PM
NO RATINGS
Thanx Max. I know the code but iam a bit stuck on how to derive the state map for the conversion which i would then use to design the sequeantial circuit.

Max The Magnificent
User Rank
Blogger
Re: How to convert BCD to Gray Code using sequential circuirt
Max The Magnificent   2/16/2014 12:13:18 PM
NO RATINGS
@BSc Student: I am to design a sequential circuit which converts BCD to Gray code. Hope you will be able to help.

This is easy-peasy -- check out this blog -- here's the code:

 

DEC   BIN     GRAY

  0    0000    0000

  1    0001    0001

  2    0010    0011

  3    0011    0010

  4    0100    0110

  5    0101    1110

  6    0110    1010

  7    0111    1011

  8    1000    1001

  9    1001    1000

Tra Da!

BSc Student
User Rank
Rookie
How to convert BCD to Gray Code using sequential circuirt
BSc Student   2/15/2014 7:35:00 PM
NO RATINGS
Hi Clive for yours interesting posts.  I hope it would be in a better position to help. I am  a final year engineering student and I am to design a sequential circuit which converts BCD to Gray code. Hope you will be able to help.

JayD030
User Rank
Rookie
re: Gray Code Fundamentals – Part 2
JayD030   6/17/2011 7:31:03 PM
NO RATINGS
It may be easier for you to implement Gray counters with T-FF but for fully optimized equations that would not be the case. A good deal of it depends upon the native FF's available (T-FF's are usually permutations of native D or JK). From a logic point of view T's are easy, you write equations for when to change so MSB's are easy and narrow equations while LSB's are complex wide equations. Generally speaking JK's work best for logic reduction because they can essentially function as both D and T with many don't care states. As for power, there are two components, static power is process controlled while dynamic power is a linear function of toggles. Since a full sequence Gray counter asymptotically approaches 2 very quickly it's reasonable to say that they take half the power of a binary counter. For a full sequence Gray counter of n bits there are 2^n toggles while for a binary counter there are (2^(n+1))-2. Or to list binary power cost relative to Gray for n bits 2 through 8: 1.500, 1.750, 1.875, 1.938, 1.969, 1.984, 1.992 respectively.

davidlsimpson
User Rank
Rookie
re: Gray Code Fundamentals – Part 2
davidlsimpson   6/9/2011 5:57:47 PM
NO RATINGS
Regarding the gray code counter, I found it easiest to use a "toggle" flip flop. The next state equations for an n-bit counter were: ns(i) := (not cs(0)) and (not cs(1)) and ... (not cs(i-2)) and cs(i-1) and (not cs(i) xor cs(i+1) xor ... cs(n-1)) I believe that the gray code counter will always be larger (binary counter toggle enable is simply an AND of all of the lower bits), use more power and be more difficult to debug. We always use binary counters and convert when we need. BTW: make sure your converted signals are registered if they cross any clock domains, otherwise you loose the benefit of gray code. Dave Simpson



Flash Poll
Top Comments of the Week
Like Us on Facebook
EE Times on Twitter
EE Times Twitter Feed

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
EE Life
Frankenstein's Fix, Teardowns, Sideshows, Design Contests, Reader Content & More
Max Maxfield

Energizing the Young Engineers of Tomorrow
Max Maxfield
15 comments
It doesn't seem all that long ago when I was a bright-eyed, bushy-tailed young engineer. Now I feel like an old fool, but where are we going to find one at this time of the day (LOL)?

Jolt Judges and Andrew Binstock

Jolt Awards: The Best Books
Jolt Judges and Andrew Binstock
1 Comment
As we do every year, Dr. Dobb's recognizes the best books of the last 12 months via the Jolt Awards -- our cycle of product awards given out every two months in each of six categories. No ...

Engineering Investigations

Air Conditioner Falls From Window, Still Works
Engineering Investigations
2 comments
It's autumn in New England. The leaves are turning to red, orange, and gold, my roses are in their second bloom, and it's time to remove the air conditioner from the window. On September ...

David Blaza

The Other Tesla
David Blaza
5 comments
I find myself going to Kickstarter and Indiegogo on a regular basis these days because they have become real innovation marketplaces. As far as I'm concerned, this is where a lot of cool ...