I want to write code for another atmega8 running at 1MHz internal RC oscillator using the Arduino IDE and its libraries. I have an ISP programmer to burn the code. What are the things that I should care about? How can I compile the code for 1MHz instead of 16MHz?
|
|
You would need to add a new hardware configuration. Here the procedure is explained for an ATMega328: http://arduino.cc/en/Tutorial/ArduinoToBreadboard but you would need to adjust the example hardware config or maybe you'll find a working one. |
|||
|
|
|
It depends specifically on what compiler/library you're using to write the AVR code, but in general, so long as you compile the code with the proper preprocessor macros For example, in the avr-libc documentation, the delay functions and UART baud rates rely on the definition of the
I have also noted the use of If you're using an integrated development environment, setting the clock frequency in your project settings may automatically define the above variables during compile-time. In that case, no settings should need to be made to the code, unless your code is using the wrong preprocessor macro (or hard-coded value) for the processor frequency. To be sure, I would double-check what macro is being set by the IDE, and ensure your code uses the correct values. |
|||
|
|