3 bit gray counter or binary counter

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
I have trouble designing a 3-bit counter that counts in binary or in gray code, depending on the values of a "mode control input". This synchronous 3-bir counter has a mode control input m. As long as m=0, the counter steps through the binary sequence 000, 001, 010 .. until 110 and repeats this sequence. As long as m=1, the counter advances through Gray code sequence 00, 001, 011, 010, 110, 111, 101 and repats this sequence. The state diagram is this one:

I'm having trouble making the karnough map, could someone help me? Thanks
 

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
Yes they are homework, upload_2017-1-15_18-28-24.png.
the 2-bits of the status represent ascending counter o descending and the 2nd represents binary or gray, if the first bit is 1 its ascending, if 0 descending. If the 2nd bit is 0, it's on binary mode, if it's 1 it represents gray mode. Still haven't got the status diagram with S1,S2,S3...
 

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
Yes it is a synchronous counter, we can use JK, and logic gates. The problem is that our teacher said that the karnaugh map has 5-variable, but I only get 4-variable. Sorry if they are some grammatical mistakes, as english is not my main language. Estado actual=Current Status Estado Siguiente=Next Status Entradas JK= JK Inputs WhatsApp Image 2017-01-15 at 18.42.24.jpeg
 

WBahn

Joined Mar 31, 2012
32,745
The sequence you described for your Gray code mode, namely 00, 001, 011, 010, 110, 111, 101, is not Gray code. As it rolls around two bits are changing to go from 101 to 000.
 

LesJones

Joined Jan 8, 2017
4,511
Note: there are only 7 of the 8 values shown for gray code in post #9. The value 100 is missing. Also in post #1 I think the links from 000 to 101 should go to 100.

Les.
 

WBahn

Joined Mar 31, 2012
32,745
Your state diagram indicates that there are two control signals, while your description only mentions one (the 'mode' signal that determines if it is binary or gray). What is the other one? A direction control? Don't make people reverse engineer a drawing to figure out what you really mean.

How many states are in your sequence? Your descriptions of the each only have seven while your state diagram shows eight. Which is it? We are not in a position to guess which is correct for this assignment. Take the time to check that your descriptions are really what you want them to be.

Also, the transition signals are written as though they are for a Mealy machine, not a Moore machine. You are showing five outputs that depend not only on the state but on the current input. What are these outputs for?

As an aside, you might consider using a different color for the transition arrows when in binary versus gray modes and might even consider different colors for forward versus reverse modes. It can make the diagram a lot easier to follow and check that it is correct.
 

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
Hi, sorry for not answring and thank you for the help. I nearly finished the circuit, but it doesn't work at all.

WBhan: I know there where a lots of mistakes on my previous posts. Here's an update.

This is the current circuit:
A=ASC
G=GRAY
Those are the inputs of JK:

J2=A'Q1'Q0'+AG'Q0+AGQ1Q0'
J1=A'G'Q1'Q0'+Q2GA'+AQ0Q2'+AG'Q0
J0=A'Q1Q2'+A'GQ2'+AQ1'+AG'Q2'+A'G'Q2+Q1'Q2+AGQ2

K2=A'Q1'Q0'+AGQ1'+AG'Q1+A'G+Q1+Q0'
K1=Q0'A'G'+A'GQ0Q2'+AG'Q0+AG'Q2+GQ0Q2
K0=G'+A'Q1Q2'+AQ1Q2'+A'Q1Q2+AQ1'Q2

+1/-1 is the CLK input, it should be a clock, but at the moment Im not using for better testing
The outputs are Q2Q1Q0

When A=1 G=1 it should do: 000 001 011 010 110 111 101 000 001...
But instead it does this: 000 001 011 000 001 011 000..


When A=1 and G=0 it should do: 000 001 010 011 100 101 110 000 001...
But instead it does this: 000 001 010 011 110 010 011 110 010...
upload_2017-1-16_18-41-11.png
 
Last edited:

WBahn

Joined Mar 31, 2012
32,745
Since there are errors in the prior descriptions, it is important that you correct those (with a new post containing the corrections -- don't change the original posts as that disrupts the context of the responses for future readers) so that we have a clear idea of what the circuit is supposed to do. There is no way we can tell if your solution is correct or not until we know what the correct behavior is.

Always make the effort to provide a clear description of the problem and the specifications that define a successful solution, even if it takes a few iterations to get there. Believe me, doing so will pay huge dividends.
 

dl324

Joined Mar 30, 2015
18,238
You haven't implemented up/down and you should only need one variable to control binary/gray.

Is there a way for you to show the logic in the J*/K* boxes?

If I'm going to check your equations, I want you to implement the full circuit so I only have to implement the complete circuit.
 

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
Of course, I'll take a while, I'll upload this comment with the pictures

J2
upload_2017-1-16_19-15-25.png

K2
upload_2017-1-16_19-16-1.png

J1
upload_2017-1-16_19-16-47.png

K1
upload_2017-1-16_19-17-21.png

J0
upload_2017-1-16_19-17-43.png

K0
upload_2017-1-16_19-18-15.png

I used this table:
The 2bits represents de A and G.
upload_2017-1-16_19-19-45.png
 
Last edited:

WBahn

Joined Mar 31, 2012
32,745
You still haven't defined your input signals. You only talk about Gray versus Binary, but you still show two unspecified signals in your transition table. Not only do we not know what the two signals are, but we don't know which is which.

Your schematic shows a signal called "ABC". What is "ABC"? How is the system supposed to behave when this signal is LO? How is it supposed to behave when this signal is HI?
 

Thread Starter

Joan Roig

Joined Jan 15, 2017
15
You still haven't defined your input signals. You only talk about Gray versus Binary, but you still show two unspecified signals in your transition table. Not only do we not know what the two signals are, but we don't know which is which.

Your schematic shows a signal called "ABC". What is "ABC"? How is the system supposed to behave when this signal is LO? How is it supposed to behave when this signal is HI?
The input on my schematic is not ABC, is ASC, A=ASC=ASCENDENT.
It counts up or down every time the CLKs get 1 impulse
G=0: When A=1 it should count 000 001 010 011 100 101 110 000... When A=0 it should count down 000 110 101 100 011 010 001 000..
G=1: When A=1 it should count 000 001 011 010 110 111 101 000... When A=0 it should count down 000 101 111 110 010 011 001 000..
 

WBahn

Joined Mar 31, 2012
32,745
What are the signals circled in green?

ttable.png

I'm GUESSING that one of them is "ABC".

I'm GUESSING that one of them is "GRAY".

I'm GUESSING that "ABC" controls forward/reverse operation.

I'm not willing to even guess which one is which in the table.

Why do you continue to refuse to tell us the most basic information about your system, such as what your inputs are and what they are supposed to do?
 
Top