# Controlling Street lights with Synchronous Counter

Status
Not open for further replies.

#### dasPhillipBrau

Joined Oct 30, 2019
24
As has been pointed out, most counters start in state 0 as that is usually the easiest state to reset them to. Since you are claiming to want a synchronous design, you want fourteen states. The sequence 0-13 is the usual one, but you can make 1-14 work. Or, ANY set of fourteen unique states.

Forget about the lights for a moment. Can you take the outputs of a four-bit counter and implement some logic so that each unique state lights up a different LED? If you want, you can just choose the 14 states you want to use.

Now, if you have those fourteen outputs (each of which is HI for one clock cycle) and you wanted another LED to be lit whenever the first, seventh, eighth, or tenth output us HI, what could you do to accomplish that?

There are many ways to skin this cat. As near as I can tell from looking at your table, there are five unique output conditions. You could use a set of states to represent those conditions and then some additional states to count the time within each output condition.
I am just not sure if the counter is starting at 0 or at 1. I mean this at a simulation software level. The numeric output never lights up the 0 alone, but every digit turns off once the cycle completes, I'm not sure if that means "its 0" or if its just not counting.

Well, with a ridiculously large amount of inverters and AND gates, I guess I could make logic that would light up 14 different leds...but I'm not sure if that's right...

And, now that I tried to do something similar, yeah, it's easy (if extremely tedious) to do the logic to light up 14 different leds, but once I try to light up a SINGLE led for more than 1 state, then everything goes to hell. I simply cannot see a way in which a set of logic gates will output 1 only from state 1 to 5 and then turn output 0 to turn it off. If I set up a NAND gate to output 1 when it receives 0001, 0010, 0011, 0100, 0101 then that logic will still trigger beyond 0101 because every other number meets the criteria for the logic to output 1. So the light will never turn off.

If I try to do it backwards (output 0 when its 0101) then it's just the same issue but backwards...thing turns off at 5 but lights up again at 6.

If I try to decode 0101 with a NAND gate, OK, it will output 1 when the inputs are 0101, sure, but it will also output 1 when the inputs are literally any other binary number asides from 1111, so in other words, the lights won't ever shut down.

And what do you mean when you say there are 5 unique output conditions? I only have 4 bits...

The order of the variables in your map makes it incredibly difficult for me to read because that's not the way I'm used to doing them. Normally the variables would be DC on the left side and BA on the top. You have it as CD and AB which makes reading the numbers tedious and prone (for me) to errors.

But, it will work. I added the don't cares and was able to simplify the equation I expected.

You have two incorrect entries in the Kmap and you aren't taking advantage of using the invalid counts as don't cares.

EDIT: Can you double check this result?
View attachment 193293
I don't get that when I don't use don't cares. It's more typical to keep the variables in MSB to LSB order, so I'd write it as D'CB'+D'CA+D'B'A. It's easier to convert to numbers, unless your native language writes binary numbers backwards.

You're on the right track.
It's just the way I was taught to make them. I double checked and I can't really find an error there, there are 3 groups of 2 (because groups can overlap) and there's no group bigger than 2. Would the order of the variables affect anything? I'm not even sure if a kmap is necessary...

#### WBahn

Joined Mar 31, 2012
26,279
I am just not sure if the counter is starting at 0 or at 1. I mean this at a simulation software level. The numeric output never lights up the 0 alone, but every digit turns off once the cycle completes, I'm not sure if that means "its 0" or if its just not counting.

Well, with a ridiculously large amount of inverters and AND gates, I guess I could make logic that would light up 14 different leds...but I'm not sure if that's right...
It shouldn't be too ridiculously large and the nice thing about using a simulator is that you should be able to copy/paste common portions easily and then make the slight tweaks needed between sections. Doing it in hardware can definitely get annoying.

And, now that I tried to do something similar, yeah, it's easy (if extremely tedious) to do the logic to light up 14 different leds, but once I try to light up a SINGLE led for more than 1 state, then everything goes to hell. I simply cannot see a way in which a set of logic gates will output 1 only from state 1 to 5 and then turn output 0 to turn it off. If I set up a NAND gate to output 1 when it receives 0001, 0010, 0011, 0100, 0101 then that logic will still trigger beyond 0101 because every other number meets the criteria for the logic to output 1. So the light will never turn off.
If I have six outputs, labeled A, B, C, D, E, and F. What would the logic look like if I want a signal that is HI whenever A, C, or F is HI and LO if none of these are HI?

And what do you mean when you say there are 5 unique output conditions? I only have 4 bits...
Let's not worry about that unless you decide to go down that road.

#### dl324

Joined Mar 30, 2015
11,848
I am just not sure if the counter is starting at 0 or at 1. I mean this at a simulation software level. The numeric output never lights up the 0 alone, but every digit turns off once the cycle completes, I'm not sure if that means "its 0" or if its just not counting.
Your counter counts from 1-14, that's 14 different states which is what the problem required. The question is whether your instructor intended for you to design a modulo 14 counter that didn't require you to use the set or clear pins on the flip flop.

Well, with a ridiculously large amount of inverters and AND gates, I guess I could make logic that would light up 14 different leds...but I'm not sure if that's right...
What do you consider ridiculously large? Are you required to do more than simulate the circuit? If not, gate count is academic.
And, now that I tried to do something similar, yeah, it's easy (if extremely tedious) to do the logic to light up 14 different leds, but once I try to light up a SINGLE led for more than 1 state, then everything goes to hell.
Weren't you taught a methodical way in which to design the decode logic?
And what do you mean when you say there are 5 unique output conditions? I only have 4 bits...
Your table has 7 outputs, that's the correct number.
I'm not even sure if a kmap is necessary...
Maybe if your boolean algebra was on point.

Last edited:

#### dl324

Joined Mar 30, 2015
11,848
It's just the way I was taught to make them.
Sure seems backwards to me.
I double checked and I can't really find an error there, there are 3 groups of 2 (because groups can overlap) and there's no group bigger than 2. Would the order of the variables affect anything? I'm not even sure if a kmap is necessary...
Without the corrections, I got 3 groups of 2 and 1 group of 1.

The red squares indicate errors:

The top square is for count=3, the bottom square is for count=7. The 2 green lights for north and south are supposed to be on for count=3 and off for count=7.

When you fix the map and add the don't cares, the logic will simplify.

#### dasPhillipBrau

Joined Oct 30, 2019
24
Guys, I appreciate the help given so far. However, it seems very clear to me, that I'm way over my element and, seeing how time is running short for the assignment, I've decided to give up and just hire an engineer/smart student to do the project for me. (so If any of you want some 10 quid, PM me)

I am really sorry about making you waste your time, but I'm simply unable to understand any of the explanations given and I think it's silly to pretend that I'm going to suddenly understand it and solve it at this point. Since I need to get max score in this project to pass the course, I cannot keep delaying it anymore.

Thank you for the help, regardless.

#### WBahn

Joined Mar 31, 2012
26,279
Guys, I appreciate the help given so far. However, it seems very clear to me, that I'm way over my element and, seeing how time is running short for the assignment, I've decided to give up and just hire an engineer/smart student to do the project for me. (so If any of you want some 10 quid, PM me)

I am really sorry about making you waste your time, but I'm simply unable to understand any of the explanations given and I think it's silly to pretend that I'm going to suddenly understand it and solve it at this point. Since I need to get max score in this project to pass the course, I cannot keep delaying it anymore.

Thank you for the help, regardless.
By all means, I wouldn't want you not to get the score that you deserve.

Please send me the details regarding the university and course number that you are taking, along with a link to the assignment or submission page, and I will be happy to take care of things for you.

#### dasPhillipBrau

Joined Oct 30, 2019
24
By all means, I wouldn't want you not to get the score that you deserve.

Please send me the details regarding the university and course number that you are taking, along with a link to the assignment or submission page, and I will be happy to take care of things for you.
Uhh mate just because I'm not good with circuits, doesn't mean that I'm actually a pillock.

Well, I phoned in an engineer and apparently all that you need to do to decode binary in the circuit with the flip flops is to use the Q' output of the Flip flop and feed it to an AND gate.

That is bloody simple, was that mentioned before?

#### dl324

Joined Mar 30, 2015
11,848
Well, I phoned in an engineer and apparently all that you need to do to decode binary in the circuit with the flip flops is to use the Q' output of the Flip flop and feed it to an AND gate.

That is bloody simple, was that mentioned before?
We knew how to do it, but it's better for you if we guide you instead of giving you the answer.

When I said I had solved the problem for a mod 14 (0-13) counter days ago, I wasn't kidding. I designed the counter the way I thought your instructor intended.

It's hard to believe this is a take home final. It shouldn't take more than half an hour. Maybe twice that for a student.

If the engineer you called knew this was a homework assignment, he's an unethical engineer. If the teacher finds out you cheated, you could get kicked out of your major program because most creditable schools frown on dishonesty.

If you decide you want to learn how to do problems like this, come back and ask.

#### dasPhillipBrau

Joined Oct 30, 2019
24
We knew how to do it, but it's better for you if we guide you instead of giving you the answer.

When I said I had solved the problem for a mod 14 (0-13) counter days ago, I wasn't kidding. I designed the counter the way I thought your instructor intended.

It's hard to believe this is a take home final. It shouldn't take more than half an hour. Maybe twice that for a student.

If the engineer you called knew this was a homework assignment, he's an unethical engineer. If the teacher finds out you cheated, you could get kicked out of your major program because most creditable schools frown on dishonesty.

If you decide you want to learn how to do problems like this, come back and ask.
I understand you knew how to do it, but why hide something so simple under something so cryptic? It's literally just about saying "You can decode the binary by using Q as 1 and Q' as 0".

He was aware it was a homework. I don't think he's unethical, rather, he's aware that most university programs are completely bloated with unnecessary courses that are just there so that the university can charge more money to the students. If I'm already a programmer, with an established career in programming (I'm only getting the degree because it helps with paperwork as a foreigner in Canada) then I absolutely have 0 reason to learn about electronics/digital circuitry so it's not a big deal if I don't actually know much when clearing the course. I did have a desire to learn at first, but after all these tries I realize it's not my forte/area of interest so it's pointless to continue smashing my head with it.

Regardless, don't worry, I didn't ask him for the solution yet, I just asked him the question straight up and he told me to decode with Q and Q'. No different as if I had paid him for private lessons. Of course, If I'm unable to solve it after the clue, then I'll have to tell him to walk me through the whole thing, but we're not there yet.

#### WBahn

Joined Mar 31, 2012
26,279
Uhh mate just because I'm not good with circuits, doesn't mean that I'm actually a pillock.
Perhaps not, but you are cheater willing to submit someone else's work as your own and claim credit for it.

Perhaps the reason you couldn't grasp what you were being told is that you've taken the cheater's way out too many times in the past and failed to learn the concepts, skills, and techniques you needed to work this problem.

I hope you get caught and expelled; you have no business being in the field of engineering or any other technical field.

Somehow I doubt you would be so cavalier if you found out that your doctor cheated their way through medical school since it is so bloated with courses they decided they didn't need to learn.

#### dl324

Joined Mar 30, 2015
11,848
I understand you knew how to do it, but why hide something so simple under something so cryptic? It's literally just about saying "You can decode the binary by using Q as 1 and Q' as 0".
AAC has guidelines for homework. Members who ignore them can be banned from this forum.

Most of us can recognize homework regardless of which forum they're posted in. New members will sometimes give answers, but other members will enlighten them.

Students asking for help here haven't mastered fundamentals. Offering guidance can be as frustrating to members trying to help as it is to the students, but helping students who really want to learn can be rewarding.

#### dasPhillipBrau

Joined Oct 30, 2019
24
Perhaps not, but you are cheater willing to submit someone else's work as your own and claim credit for it.

Perhaps the reason you couldn't grasp what you were being told is that you've taken the cheater's way out too many times in the past and failed to learn the concepts, skills, and techniques you needed to work this problem.

I hope you get caught and expelled; you have no business being in the field of engineering or any other technical field.

Somehow I doubt you would be so cavalier if you found out that your doctor cheated their way through medical school since it is so bloated with courses they decided they didn't need to learn.
Or it's simply because it's not my area of interest and I realize that dedicating time to something which I don't like and have absolutely no use for in my career is just pointless. You're acting as if I'm asking someone to write my thesis Lmao. Even you guys admit that the course is extremely basic, and being the only electronics course in the curriculum, it should be enough proof that even a student who approves the course with maximum score with his eyes closed, isn't actually qualified to work with something related to electronics.

If the doctor cheated in his surgery class then I'm probably gonna be mad (or dead) because of it, but if he cheated to approve his world history and sociology class that he was forced to take because the tuition for it was like 5k, I'm not even going to be remotely mad, I might even give him a high five for beating the system. How is it ethical for an university to force you to pay an absurdly high amount of money for a course that will not help you at all in your career?
You've still failed to tell me how would a basic electronics course help someone who's been working exclusively in software development for 6 years.

Apply nuance to situations, things in real life aren't binary extremes. If you were studying pure electronics and you paid someone to write a paper for a "history of languages" class, it's hardly going to mean that you would set a puppy on fire or that you would sign an unsafe electrical diagram.

Last edited:

#### dasPhillipBrau

Joined Oct 30, 2019
24
AAC has guidelines for homework. Members who ignore them can be banned from this forum.

Most of us can recognize homework regardless of which forum they're posted in. New members will sometimes give answers, but other members will enlighten them.

Students asking for help here haven't mastered fundamentals. Offering guidance can be as frustrating to members trying to help as it is to the students, but helping students who really want to learn can be rewarding.
But the decoding thing wasn't even an answer. I'm actually still trying to figure it out (With a lot of progress). It's literally just a piece of the puzzle. I still have to do work to get it, except that, now that I get it, I've advanced considerably.

I never asked you guys for the exact answer, and since the start I mentioned what my issue was.

#### dl324

Joined Mar 30, 2015
11,848
But the decoding thing wasn't even an answer.

There's no excuse for cheating just a little. Cheating is cheating. If the teacher grades on a curve, cheating could potentially affect the GPA of students who are taking the class as part of their major.

#### djsfantasi

Joined Apr 11, 2010
6,950
In my school, cheating just a little got you expelled just a little.

#### dasPhillipBrau

Joined Oct 30, 2019
24

There's no excuse for cheating just a little. Cheating is cheating. If the teacher grades on a curve, cheating could potentially affect the GPA of students who are taking the class as part of their major.
Understanding of this part has led me to being able to solve the problem on my own. I was literally just having a small overlook that the Q' would output 0.

Where have you seen an university that applies curves like that? Every single uni I know of, including mine, has curves where the student GETS extra points, rather than having the minimum passing score reduced, that way no one is actually penalized for the mistakes of other students. Also, professor can only grade with a curve if over 70% of the class failed, and if that happened, that's a very damn good indication that the professor was not doing a right job, so it's fair to cut the students some slack.

I'm pretty sure you guys have actually cheated on parts of your life, maybe a school exam, maybe parking in a yellow line spot because you wouldn't be there fore more than 2 minutes. Don't be so black and white over stuff.

And to clarify, I don't even consider this cheating since, as I already said, I didn't actually ask for the answer but for clarification on the subject. You really consider hiring an expert to explain the subject to be cheating?

Well, in any case, as interesting as discussing ethics might be, I don't think it's the right place to do so.

#### WBahn

Joined Mar 31, 2012
26,279
Since you don't consider it cheating, why do I have the feeling that you've never documented who you paid to provide the answer that you submitted? Perhaps because you know that the instructor and the university will consider it cheating?

#### dasPhillipBrau

Joined Oct 30, 2019
24
Since you don't consider it cheating, why do I have the feeling that you've never documented who you paid to provide the answer that you submitted? Perhaps because you know that the instructor and the university will consider it cheating?
There is literally a bulletin board where professionals announce their services for students struggling with the subjects.

#### dl324

Joined Mar 30, 2015
11,848
Understanding of this part has led me to being able to solve the problem on my own. I was literally just having a small overlook that the Q' would output 0.
I missed the fact that you weren't using the inverted outputs on the flip flops. Some commercial flip flops don't have complementary outputs. In those cases, we just use an inverter when we need the inverted output.

How many gates did your solution take?

#### WBahn

Joined Mar 31, 2012
26,279
There is literally a bulletin board where professionals announce their services for students struggling with the subjects.
So? What does that have to do with anything? No one is disputing that there are disreputable people in technical trades -- you are doing your best to become a case in point.

There are bulletin boards where all kinds of unethical and/or illegal services, up to and including murder for hire, are offered. Does the fact that they exist mean that people that use them are not doing anything wrong?

Status
Not open for further replies.