• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with a up and down counter

Status
Not open for further replies.

fateo66

New Member
I need help figuring out what chip (preferable a national semiconductor) that I need to build a 3 bit counter. I just need it to basically count up when one switch is pressed and then down when the other is pressed.
 

shimniok

Member
This sounds oddly familiar... school assignment?? :D (We have another thread that sounds like exactly the same assignment)

Is it ok to use one chip that is 4 bit? (if so, google '4-bit counter' and see what you come up with)

Is it ok to use multiple chips -- like flip flops?

Michael
 

fateo66

New Member
Actually its not for a school assignment it is for a car project that I am working on therefore I can really use anything. And I really only need it to count from 1-4 so 3 or 4 bit would work.
 

shimniok

Member
No idea -- but no matter. As far as I am aware, the 74193 is a standard 74-series logic chip; it operates basically the same whomever makes it. So you could get the national semi version of this. The 74HC193 is a (IIRC) high speed CMOS implementation so you'd want to use 74HC logic chips elsewhere if needed (like for a 7-segment driver). There's several types of 74 series logic... ALS, LS, etc. Btw, I am guessing you can get the chip for a buck or less (not counting shipping of course).
 

fateo66

New Member
I guess I'm really new at this because even this is still over my head. I know how to read schematics fairly well but most of the information on that data sheet I don't understand.
 
Last edited:

MikeMl

Well-Known Member
Most Helpful Member
...And I really only need it to count from 1-4 so 3 or 4 bit would work.
Actually, if it only needs to count 1,2,3,4 it has only four total states, so it only needs to be a 2bit counter. 2Λ2=4.

So, it needs two inputs; Dir (0=count down, 1=count up) and clock (count on every rising edge).

Next question, what happens if you keep counting up? e.g. does it go 1,2,3,4,4,4,... forever until the Dir is changed? Or does it roll over, as in 1,2,3,4,1,2,3,4,1,...

Similarly, what happens if you keep counting down? roll or repeat at 1?

Also, does it need to have an asynchronous Clear input that sets the counter to 1 independent of the Clock?

Do you need to have a separate decoded output to signify which state the counter is in?

Maybe you should describe in more detail what you are trying to do with the counter.

This can be done with a dual flip-flop and a few gates. Answer my questions and I can help you with it.
 
Last edited:

fateo66

New Member
Thank you for all your help everyone! Here is the main details to my project. I am creating a push button shifter for my car. If the gear selector is placed in drive all four gears can be activated electronically threw there corresponding solenoids. 1st uses S1 and S2 2nd uses S2 3rd uses no solenoids and 4th uses S1 and S3. Also there is a corresponding LED on the gauge cluster that I will be using to indicate the gear I am in. That way if I use a 3 bit counter, the sequence would be 1234444 but 1234 would be ideal so I guess I should just use a 2 bit (I forgot about 0 being a output). If I can get help figuring out which IC will count like this I can use the outputs to drive a relay to drive the solenoids and indicator lights.
 
Last edited:

MikeMl

Well-Known Member
Most Helpful Member
Hey, I already posted a design for an electronic gear shifter. I'll see if I can find it.

Here it is; read the entire thread.
 
Last edited:

fateo66

New Member
WOW, thats seems to be exactly what I need. Thank you. So it looks like I will need one lm7805, one 74hc14, one 74hc74, and two 74hc00. Now is V2 and V3 also 14v? And I his logic is different then mine, so I just need to hook up a relay to each of the four out outs, would that be where the s1, ~s1, s2, and ~s2 are? I am a little lost on that part. Sorry for my newbness
 
Last edited:

shimniok

Member
Very cool. I, too, haven't played with state transition tables etc in 20 yrs so this is a good refresher. If I read correctly, your shifter solenoids have to be set a little different in at least 3rd and 4th...
 

MikeMl

Well-Known Member
Most Helpful Member
I redesigned it specifically for your case. There are two State Variables: S1 and S2, which count in a Gray Code. There are two inputs: UpSwitch and DownSwitch. There are 7 outputs: LED1,2,3 & 4, Sol1,2, & 3.

First look at the State Diagram. Note how I assigned the State Variables to the four states. Note that counting down from the First state stays in First. Note that counting up from Fourth state stays in Fourth. Note what outputs are asserted in each state.

The two terms DS1 and DS2 are the equations which implement the correct state transitions while shifting up and down. They become the D inputs to the two state Flip Flops, which I choose to use D flops for (rather than JK). I chose the order of the states specifically to make driving Sol1 and Sol2 easy. Sol3 is a special case.

The four LEDs are decoded off the states S1 and S2.

Note that V2 and V3 in the schematic are there for LTSpice simulation only; the switches are your physical switches. I would use a center-off, spring-return switch as the "gear-shift". Wire the common to Gnd, and the two sides to DswL and UswL, respectively.
 

Attachments

Last edited:

fateo66

New Member
I found the schematic for the gauge cluster that I am installing into my car. I am using the four triangles to indicate the gear I am in and the "driver controlled center diff module" is not there and that is where I need to hook this circuit into for the lights. If I take our R3 R5 R6 and R7 will the NAND gates be able to take the amperage or do i need to run four more IRF7201? If so how should I go about doing that?
 

Attachments

Last edited:

MikeMl

Well-Known Member
Most Helpful Member
Those are lamps, so you will have to buffer the Nand gate output, which can only sink 5mA or so. The Nand gate output is low when the lamp should be on. You could substitute four AND gates, which would give you a high to turn on the gate of a NFET. You dont need to duplicate the FET that drives S3.
 

MikeMl

Well-Known Member
Most Helpful Member
Can I leave the four NAND gates and just sink it to four irf7201 that way I can leave 4L?
Not without adding an inverter between the nand gate and the gate of the FET. The nand gate produces a low at its output. The FET gate needs to be high to turn on the lamp.

I would buy one quad AND gate, add the four FETs, and use the FOURTH FET to sink both the S3 solenoid and the Fourth lamp by hooking them in parallel (top end of both connected to 14V)
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top