Does this kind of counter IC even exist?

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
User avatar
GoingFastTurningLeft
Posts: 163
Joined: Wed Sep 06, 2006 7:33 pm
Contact:

Does this kind of counter IC even exist?

Post by GoingFastTurningLeft »

I'm finishing up my design for an H-pattern gear shifter that interfaces to a console video game wheel that only has gear up and down buttons. It only uses a couple discrete logic ICs.

I need it to keep track of what gear its in, and I designed that part of the circuit to use a 4-bit binary up/down counter w/preset.

I want to use an asynchronous counter, but I can only find synchronous counters that function like this. Do they exist in this configuration?

Or is my best bet to figure out a way to 'trick' a synch counter to think it's asynch? Its very important that this counter cannot 'miss a gear'
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 »

That's a pretty clever design to take a 5-position input and figure out how many pulses it needs to send as it goes from one position to another using discrete ICs. I can't see a way to do it without implementing a state machine. Care to describe what you did? I would have thrown a small MCU at the problem, but that's cheating ;-)
ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:

Post by ecerfoglio »

You can use a syncronous counter like the cd 4029.

The clock input stays (normally) high.

The "Gear up" button must set (high) the up/down input and pulse the clock input low and then high (**)

The "Gear down" button must RESET (set low) the up/down input and pulse the clock input low and then high (**)

When the clock input goes from low to high the counter increments or decrements its count.

(**) the pulse circuit may be a simple RC network or a more elaborated one shot timer (like a 555, maybe part of the button debounce circuit)

A quick google search for the CD4029's datasheet found http://pdf1.alldatasheet.com/datasheet- ... D4029.html
E. Cerfoglio
Buenos Aires
Argentina
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba »

Hmmm, I think it's doable but a bit complex. use a counter for previous state. current state is the switches in the gearshift. use an encoder for the switches. Use that and the previous state counter as inputs to a magnitude comparator (74xx688). that will tell you if the current gear position is higher , equal or lower than the previous one. send the up or dwon pulse and inc/dec the previous state counter. You will have to work out how to clock the whole thing (any switch open+close creates a clock pulse?) and you'll need debouncing on the switches. i suspect many glitches lurk in this design...

The funny thing is, for a 4 speed gear shift, this could be done with an 8 pin PIC and some pull-up resistors. probably in about 20 lines of C code for around a $1 worth of parts!
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba »

ecerfoglio wrote:You can use a syncronous counter like the cd 4029.

The clock input stays (normally) high.

The "Gear up" button must set (high) the up/down input and pulse the clock input low and then high (**)

The "Gear down" button must RESET (set low) the up/down input and pulse the clock input low and then high (**)

When the clock input goes from low to high the counter increments or decrements its count.

(**) the pulse circuit may be a simple RC network or a more elaborated one shot timer (like a 555, maybe part of the button debounce circuit)

A quick google search for the CD4029's datasheet found http://pdf1.alldatasheet.com/datasheet- ... D4029.html
doesn't that have the problem of not handling down shift? going from 3 to 2, for example.
ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:

Post by ecerfoglio »

philba wrote
doesn't that have the problem of not handling down shift? going from 3 to 2, for example.
The CD 4029 is an UP/ DOWN counter: It has an input pin (U/D) that sets if it counts up or down.

It also can count from 0 to 9 (decimal mode) or from 0 to 15 (or F if you like hexadecimal) (binary mode), and can be reset or preset to any value you like.

It´s a very versatile little chip. Or course, from the pre-microprocessor era :smile:
E. Cerfoglio
Buenos Aires
Argentina
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi there,

Another idea might be this...

Use an 8 to 3 line encoder ic to convert the H switch contacts into
binary, call the 3 lines ABC.
Store the previous binary ABC in a latch (have to use a 4 bit ic).
Use a 4 bit comparator ic to compare latch to current ABC, and then...
if current ABC is greater than latch press "up gear"
else if current ABC is less than latch press "down gear"
else dont press anything.
After that, clock the latch to store the current ABC.

If you make 'neutral' equal to binary zero you can power on reset
the latch to zero and you'll start out by having the shifter in neutral too.

IC's required:
8 to 3 line encoder (1)
4 bit latch (1)
4 bit comparator ic (1)
one shot (1)
nand gate or nor gate (1)

The one shot will be used to pulse the latch once a new gear
has been selected. The time period will be say 100ms. The latch
(like a 74LS75 type) will hold the count after the 100ms time period
is over. The one shot will be triggered by both the 'greater than'
and the 'less than' output of the comparator ic (might require either a
nand gate or a nor gate or similar).

If you find you can shift twice faster than 1/10 of a second, lower the time
period to 50ms.
LEDs vs Bulbs, LEDs are winning.
User avatar
GoingFastTurningLeft
Posts: 163
Joined: Wed Sep 06, 2006 7:33 pm
Contact:

Post by GoingFastTurningLeft »

Actually, that is something like my design.

This is what i've come up with.

Gear is in BCD, with 0 = R, 1 = 1, etc.

Button entry block - consists of a couple logic gates arranged so that pushing the gear button outputs its 3 bit BCD value. Its initially being designed for a 4 speed but i could upgrade it to 6 speed (provided I come across another worthwhile racing game) This contains a 4-bit latch to hold the value. Thanks for the 8-3 encoder idea, might be able to make that work.

Comparator block - uses 4-bit magnitude comparator to compare output of the button entry block and 'gear' block. Enabled by the clock block, possibly also by a 'clutch' pedal which prevents shifting unless a clutch is pressed. High output goes to down input of gear block and down input of an analog switch, low output goes the opposite.

Clock block - simple 555 circuit, f adjustable in the range of 0.2 Hz. It can't be faster than the game can respond to gear shifts.

'gear' block - 4-bit BCD up/down counter w/ preset. The output of this goes to the magnitude comparator and a custom 7-segment display driver circuit, all because i need something resembling an R instead of 0. It needs a preset to fix it, as well as for when it starts you in a certain gear.
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 »

If you always shift sequentially it's easier, but I was thinking how I drive when I sometimes skip gears.

e.g., there's a part of my commute to work where I have to make a *sharp* left turn onto a road that then immediately makes an S and stops a few 100 feet later. Before the turn I'm in 6th gear doing about 70+, after I'm usually in 3rd going about 40, so it's hard braking, turn left and drop 3 gears in one shift (BIG blip of the throttle :-) and continue on.

It's a fun turn in my 2-seater, but a counter design to handle this would need to be capable of sending different # of pulses depending on how you're shifting: ( 1-2 is 1 pulse, 4 to 2 is two pulses, etc) that's why I thought is was non-trivial.

Again, this is a simple project with a microcontroller...
User avatar
GoingFastTurningLeft
Posts: 163
Joined: Wed Sep 06, 2006 7:33 pm
Contact:

Post by GoingFastTurningLeft »

I do enjoy road courses so there are times where I'll be in 4th and have to slam the brakes and downshift to 1st to make a real tight hairpin. I really don't need to skip gears going up, its just going down.

Once I get into microcontrollers I'll probably redo this, but I'm not into them yet. Its only really the easy way if you actually have all the equipment and experience to do it already, which I don't.

I also have a fair number of these components lying around anyway.
User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott »

A counter IC may not be your easiest or siplest solution if you are going to be randomly selecting gears.

If you have a switch at each location of the gears in the H pattern, then you can wire diodes as necessary from each switch to the 3 lines of the BCD bus input of a multiplex chip. Have 1 resistor on each of the 3 lines to ground. The other side of the "gear" switches wire to +5V.

It's a "wired OR" situation that can be solved simply with a few diodes. A MPU is overkill.

Geez, my toaster has CMOS logic in it.

Bob
User avatar
GoingFastTurningLeft
Posts: 163
Joined: Wed Sep 06, 2006 7:33 pm
Contact:

Post by GoingFastTurningLeft »

I think you missed the point. Diodes are not going to send a certain number of timed pulses to an analog switch.

The original button->bcd design was done with a bunch of diodes and pull up resistors, though.
User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott »

Ooops. You're right. I thought that you were just wanting to make a readout. My mistake. I keep away from video games.

Bob :cool:
User avatar
Edd
Posts: 885
Joined: Sun Jan 27, 2002 1:01 am
Location: Dallas Tx
Contact:

Post by Edd »

.

Keying in on the sole last given statement:

<< The original button->bcd design was done with a bunch of diodes and pull up resistors, though.>>

I will throw in one more solution that I had done back in the mid seventies for the display of what gear a sports car
(with its small short shift pattern) was in.
The solution required no logic chips , had no memory problems , no counter error problems, with a resultant response
being as quick as the final end positioning of a shift.

The technique was thus:
The boot above the shift covered up all of the mechanics below it, but what I created was a 2 mm thick sheet of 3X3â€
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hello again,

If you are going to be skipping gears (shifting up OR down) then
a slight modification is in order.
Instead of the latch use a counter like you were saying. Have
the output of the comparator clock the counter up or down and
if the count still isnt equal let it clock the counter again and again.
Of course you still need to pulse the games up or down button
but now with every compare that is done.

This is starting to cry for a PIC or something :smile:
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests