Maximum frequecy (tone) with ATMega238?

Does anyone know what the maximum frequency you can produce with the arduino? I know tone() outputs a square wave.

I would like to go up to around 1.5mhz, is this possible with the Arduino? If not, what other hardware can I interface with to do that?

ivango:
Does anyone know what the maximum frequency you can produce with the arduino?

8 MHz.

I would like to go up to around 1.5mhz, is this possible with the Arduino?

Assuming I did the math correctly…

1,600,000 Hz
1,454,545 Hz

Can’t do exactly 1.5 MHz.

So, the answer depends on what you mean by “around”.

The documentation for the Tone library says:

"After all is said and done, because play() only accepts unsigned integers for frequency, the maximum frequency that can be produced is 65535 Hz - which, after rounding, results in a 65573.77 Hz "tone" on a 16 MHz part. Even if play accepted larger values for frequency, you couldn't achieve better than around 80KHz with the Tone library because the pin toggling is done in software. Each toggle, in software, requires AT LEAST 50+ cycles.

You might be able to get close to your desired frequency by using one of the hardware timers. This library should get you started: http://www.arduino.cc/playground/Code/Timer1