Go Down

Topic: fastest speed of input pins, hardware prescaler (Read 770 times) previous topic - next topic


I would like to connect a very precise crystal, around 11MHz, to an input pin of the Arduino (running ar 16MHz), then use a hardware prescaler in the arduino, if that exists, and ultimately trigger my code at a fraction of that 11MHz, maybe divide by 256. I don't know if I can do the divide by 256 inside an interrupt, since the few instructions it will take will overlap the next 11 MHz beat. So is there a way to set timers or prescaler so that the interrupt is called every 256 beat on the pin ?
Thanks !


Why not run the arduino at 11MHz?  It will run if you change the crystal or build a standalone board.
Then you can run a timer (e.g. timer2) using a prescaler on the clock frequency.  Your millis() timer would be out, but perhaps
that doesn't matter to you.  I don't think there is any internal prescaler you can use.

Or you could use a standalone board with an 11Mhz crystal, driving its own timer,  feeding into a second arduino.
That takes a 328P chip, two capacitors, a crystal and a resistor + capacitor for the reset line.  You could even write
the sketch to work on the arduino, then move the chip to your standalone board.


Connect an 11mhz oscillator to a counter and have bit 8 tied to PD2 or PD3 and set it for a pin rise interrupt?
I will never ask you to do anything that I wouldn't do myself.


Not exactly mentioned, but you cannot simply connect a crystal to an Arduino
pin and have it oscillate. You need an "oscillator" circuit for that, like on the
Arduino crystal pins.

I haven't done this specifically on Arduino, but built-in timers are in fact designed to
do the sort of counting you want.  You can set up their prescaler value and rollover
period [value=1..256], and trigger an interrupt with the rollover, so you can basically
get any rollover value you want.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131