Step 8: Program the Microcontroller
I loaded the program onto the atmega168 by using an avrisp mk II to circumvent the bootloader on most chips used with Arduino. This is because I wanted an instant startup, and it also allows for more program space(although, not much).
To do this, there are good resources here, here and here to burn a bootloader. In place of the bootloader just use the .hex file found in the applet folder of the arduino sketch folder (which is the one I have attached to this step and the introduction).
To change any aspects of the file, I have also included all of the commented code, just click 'upload to board' (you will get an error unless you have an arduino plugged in) to re-compile and the .hex file will change to the new code.
Odds are that your crystal won't be exactly 20.0Mhz, so it will need to be calibrated to keep accurate time. To do this, just change the oneMin variable in the code, mine is 60116.
The clock speed is currently compiled to run at 20 MHz. To change it you will need to change some numbers in the arduino preferences and board definition files, as found here.
Remove these ads by
Signing Up













































Visit Our Store »
Go Pro Today »




Mine is IBM thinkpad R50E. Yay I always thought I'm the only one in the world that owns that laptop.