Quadratic wave generation

Hi everybody

As "promised" in another thread i did some homework (reading again and again the datasheets for ATMega128) and to be honest i filly dizzy!!
I admit it did improve my knowledge, but i still don't understand how i could implement the following:

i need to create a quadratic wave which must be exactly at 38.5kHz. I did a lot of reading for two days and it's not clear to me how to achive this.

  1. I thought of using Timer2 interrupts (this is a general usage timer, so i can use it however i want, right??)
  2. As far as understand one must use an interrupt driven approach, but what kind of?? Overflow, counting, ...
  3. Do i need to use PWM??? or is there something else? (or is this related to 1. above ?)
  4. The math behind each approach is not clear. I 've seen samples where TCNT is set and other which don't use it at all. (again: is this related to 1. above??)
  5. The application should be verrrrryyyyyyy accurate, this means that these 38.5kHz should be guaranteed regardless if the system works in a "temperature neutral" place like my home or next to a diesel engine (which creates heat). Am i right to assume that this will guaranteed by the fact that the Arduino board uses a crystal (Arduino Duemilanove), which won't have declination in temperature ranging from +5 Celsius to +70 Celsius?
  6. Assuming that 4. above is correct, we must not use the internal clock

Please don't shout at me, cause this is my first journey to this microcontroller territory (i 'm a software developer in the .NET field) and i want to clear the fog in me!

Thanks in advance

What is the quadratic function?
Have you thought of a wave table and phase accumulator?

Think a square wave is meant.
Maybe the tone library is a nice reader Google Code Archive - Long-term storage for Google Code Project Hosting. in this context. Especially read the "Ugly details" section. It seems to be able to reach 8Mhz so 38500 Hz should be possible.

Rob

The application should be verrrrryyyyyyy accurate,

Please note accuracy of 38.5Khz is different from accuracy of 38500 Hz (error is defined as + - the half of the least significant digit provided)