Not quite sure what I'm looking for here
or rather I know what I want, but don't know what it's called or even if it exists
I want (stamps little feet) a chip that I can:
a) feed a clock signal into
b) feed an 8-bit number into
the chip counts until it reaches the 8-bit number then resets back to 0 and starts again
hope that's clear
please make me look stupid and tell me that a 74XX999 does it all in one package!
Sure - go to ww.ti.cm & search for counters - they have parts that can be preloaded & then count from there. Might have to count down from the # to 0.
CD40103 looks good - presettable 8-bit counter with an output that signals when 0 is reached.
What you you want the OUTPUT of this chip to be? And for that matter, how do you intend to "feed an 8bit number into" it ?
There are a large number of "presettable counters" implemented withing simple logic families (the CD40103 mentioned being a good example), BUT they 1) tend to be DOWN counters that count downward from the preset value. 2) The "reset" at zero may not be automatic; you may have to detect zero and reload the preset. (ie the "load" command is separate from anything else, and the value is lost as counting begins. To have the value RE-load, you at least need to have two copies of the loaded value; one that sticks around to be loaded next, and one that actually is present in the counter.) There may or may not be a zero detect, though "wrap" (overflow/underflow) is pretty common.
These problems lead you to the more complicated "timer/counter" chips, the most famous probably being the 8254 used in the original IBMPC (and therefore copied (in some form) into every PC compatible ever since. But these have microprocessor-bus oriented interfaces, so you probably don't have access to the count at intermediate stages, and "feed in a number" may be more complicated than you had in mind.
The internal timers in the Arduino's AVR chip can generally be programmed to behave as you request. But they're all in use by the the arduino core functions for generating PWM and etc. Depending on how fast you need it to count, using some other microcontroller is a possibility. Counter/timer hardware is very common even in very low-end micros (say, those 6-pin PIC micros), and at lower clock speeds the whole thing can be done in software. Even an arduino-class CPU is liable to cost less than the 8254 timer chip I mentioned...
I must confess having looked at the chips available, that a software solution may be the way to go
thanks, btw to CrossRoads for the hint
count up or down isn't an issue
maybe better expressed (now I have seen some chips) that divide-by-n is what I want, but n to be software configurable
happy to feed in "n" however it needs, but not every n cock ticks, please!
I want to be able to pass in a clock and get a transition after n clock cycles
count up or down kinda doesn't matter
but having to keep reloading might be
to confuse the plot I want to have three or four of these on the go at any one time, with different "n" values for each
I may well go down the route of a second ATmega chip to do the work
off to do some test timings
Maybe a bank of CD4059's will do the the trick then:
divide by 4 to 15,999.
Maybe with a 16 bit shift register in front of them to load them up from a couple of arduino pins.
Or just hardware the inputs hi/lo if the divide-by won't change.
You haven't said how fast of clock, so unknown if an arduino could do it.
Course, buy 4 of these from digikey and now you've spent more than the cost of an arduino clone
Depending on this goes into, a promini from gravitech might be the way to go also.
that's my thinking
get 4 of them and you're close to the cost of an xxxduino!
and software is soooooooo much easier to wire up (and change later!)
Not sure what level of effort you are looking into, but you might consider a CPLD. You can "program" the device to be whatever counter you want. If you aren't familiar with PLDs, there will be a learning curve. However you can design the exact divider you are looking for.
just ran a loop test
looks like I can achieve better than 62 KHz with 6 "divide-by-n" counters and some fringe processing
that will do nicely!
Looked at CPLDs - as you say - bit of a learning curve - :gulp:
d******d expensive though
To me... it sounds like you are talking about a 74192 or 193 (presettable up/down counter)
In the 80's, I made a COUNTDOWN DARKROOM TIMER with these that you could preset to the number of seconds you wanted the enlarger light to be on. (Preset using BCD thumwheel switches)
looks a bit more likely!
not overly expensive
need to tie a couple together to get 8 bit but that's doable
thanks for the sterr!
I agree with Pwillard.
You could use one or two 74ls193 4 bit up down counters and use the 74154 as a de-multiplexer. A few NAND Gates (7400) to toggle which one is counting and thats that.
Yup, that's probably the way I'll go
Busy prototyping in software before I commit to metal
Thanks all for the input