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.
- I thought of using Timer2 interrupts (this is a general usage timer, so i can use it however i want, right??)
- As far as understand one must use an interrupt driven approach, but what kind of?? Overflow, counting, ...
- Do i need to use PWM??? or is there something else? (or is this related to 1. above ?)
- 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??)
- 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?
- 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