Is there an IC that will count up - and that I can read with the Arduino using something like SPI?
I was thinking of using the Arduino to count - but it makes more sense to use an external circuit.
James
Is there an IC that will count up - and that I can read with the Arduino using something like SPI?
I was thinking of using the Arduino to count - but it makes more sense to use an external circuit.
James
but it makes more sense to use an external circuit.
I would tend to disagree because you need lots of input pins to read the counter.
Anyway something like a 74LS93 or 74LS161 would do the counting.
Mike - do you not think the fact I am using an interrupt at what might be quite a high frequency might end up pausing my program a bit?
It needs to count up to a decent number as well... I guess you can somehow stack them to get bigger numbers... I could read them in using a shift register?
quite a high frequency might end up pausing my program a bit?
You didn't say that. What frequency are you going at?
I guess you can somehow stack them to get bigger numbers
Yes you simply chain them with the Q3 going to the input of the next counter in the chain.
However the ATmega168 (and others) have a built in counter. They are normally used as a timer but they are counter / timers and can be triggered from an external pin to count without any program intervention. I don't know what you are trying to do so I can't say if this would be a better solution but there are 8 bit and 16 bit counters. See the data sheet for the chip.
Mike,
Its for my rally computer project - so it's counting wheel revolutions - possibly 4 per turn of a wheel (or if before the differential, more)
Might not sound like a lot - but it seems to be a better idea to keep it separate instead of interrupting the app - especially as it's variable.
James
OK but in electronic terms anything that is connected to something mechanical is going very slowly. I would have thought an interrupt would have been fine.
What about the internal counter solution?
If your Interrupt will only count, then you can deal easily with 10 000 per second. However you have to ensure that you do not block interrupts (for example implicitly in the timer interrupt) or by using delayMicroseconds.
But if you want a counter, why not use the built in timer2 counter? You would need hardware debouncing. However you would need this with an external counter chip as well.
Look up the documentation of ASSR / EXCLK in the datasheet.
Cheers, Udo
If your Interrupt will only count, then you can deal easily with 10 000 per second.
And even at 4 counts per revolution, that's 150 000 rpm!
ok well 10,000 per second is more than enough... I am obviously underestimating the Arduino (or over estimating the car?!)
Thanks guys - I will look up the timer2 - this seems like by far the best solution.