ATMEGA8 Programming
As many of you are already aware, I have been doing a fair amount of Arduino programming over the past year. The Arduino platform is built as a very rudimentary introduction to hobbyist electronics. Arduinos come with all of the necessary parts to begin building simple circuits with a very low learning curve. It is the perfect introduction into the world of electronics. Since the Arduino makes circuitry extremely easy and uses a gimped version of C as its programming language, many electronics enthusiasts are reluctant to give it any credit. In my case, the Arduino has proven very useful as an introduction to electronics and circuitry. I thank Limor Fried and Phillip Torre for all of their tutorials, chats, and other guidance from adafruit.com over the past year. Limor and Phillip are large promoters of the Arduino platform, but they too realize that is is only a stepping stone to the much larger world of electronics.
This past week, I have taken my second step into electronics and circuitry (I’m sure there are n steps). I have learned a great deal from the Arduino platform but I feel that I have learned all that I can from it due to its over-simplicity. In order to further my understanding of these integrated chips, I have moved on to programming the ATMEGA8. I am programming it through standard C with the avr-gcc suite. I have yet to delve into its assembly language, but that is something I would consider in the future. For now, programming in C suits me just fine.
Part of the reason I am working with the ATMEGA8 is for the Computer Science Club at Mansfield. I am the current president of the club and we are in desperate need of new members. All of our officers are graduating and moving on at the end of this semester, so it is vital that we find replacements. We are doing a number of things to generate interest in the club and programming ATMEGA8 chips is one of them. Mark Burger, the vice president, and I would like to build some games on these ATMEGA8 chips and sell them for a small profit. This would generate more interest in the club, as we are building our own games and it would also serve as a minor fundraiser for the club. An advantage of using ATMEGA8 chips is that they are vastly cheaper than buying Arduinos and programming them. We plan to use this to our advantage and be able to make an affordable game.
Right now, what I have is fairly basic. It has taken me about a solid week to figure everything out up to this part, including: programming with the programmer, writing code, interfacing a LCD (writing custom characters, turning the cursor on/off, turning advancement of the cursor on/off, etc.), doing register I/O on the ATMEGA8, and a few other minor details. What I have so far may not be impressive, but coming from an Arduino user, it certainly is.
My current project is writing a simple and lightweight LCD interface where the user can use the two buttons on the board to either advance the cursor (and add a space if needed) or cycle through the letters and symbols available in the CGRAM of the LCD screen. I use a standard HD44780 LCD, so this project should work for any similar LCD screen. Below is a picture of my project. Most of what is on the breadboard is residual from past projects and is not in use. All I use once it is programmed is two buttons, an LCD screen (with a contrast potentiometer), and the ATMEGA8.
In the future, I am looking into a number of games including a classic snake game, a maze game, a simplified nethack dungeon game, and a hangman game. If anyone has any good ideas for a game that can be played on a 20×4 character LCD screen (or 16×4), please write a comment or send an e-mail. I would be glad to hear from you.
As it stands my LCD code is posted on GitHub here. I also have a video imbedded below of my project in action. Click here to go to YouTube to view the video in HD.











