Introduction to the ATmega128
Atmel - 1
San José State University Dept. of Mechanical and Aerospace Engineering
Introduction to the Atmel ATmega 128 Microcontroller
To introduce students to the Atmel ATmega 128 microcontroller, STK500 and STK501 interface
boards, and associated hardware.
To introduce the components of AVR Studio, a freeware programming environment for the ATmega
To learn how to write a serial communications program in C-language using the AVRlib examples.
To learn how to compile a program using the GNU-C compiler for AVR processors.
To learn how to download and run a program on the ATmega 128 microcontroller.
Atmel ATmega 128 microcontroller mounted to a
STK501/STK500 interface board
Serial programming cable
12 VDC power supply
6-pin ribbon cable
2-wire jumper with female plugs on both sides
A microcontroller can be a powerful tool when building electro-mechanical systems. Like a mini, self-
contained computer, it can be programmed to interact with both the hardware and the user. Even the
most basic microcontroller can perform simple math operations, control digital outputs, and monitor
digital inputs. As the computer industry has evolved, so has the technology associated with
microcontrollers. Newer microcontrollers are much faster, have more memory, and have a host of input
and output features that dwarf the ability of earlier models. Most modern controllers have analog-to-
digital converters, high-speed timers and counters, interrupt capabilities, outputs that can be pulse-width
modulated, serial communication ports, and the list goes on.
The ATmega 128 microcontroller is one of the more recent versions of Atmel’s 8-bit RISC processors
in AVR family. It is a fairly inexpensive controller (about $15) with plenty of features that you will
explore throughout the semester. Thanks to the Atmel Corporation, you will be able to borrow a
microcontroller evaluation board for the semester that can be used to program the ATmega 128 and
other Atmel microcontrollers.
In this lab, you will gain an understanding of the basic hardware of the microcontroller and
interface boards. You will learn how to build, compile, download, and run a project written in C-
language, and you will learn how to use AVRlib, a library of pre-written C functions.
The compiler and programming environment, as well as the libraries for AVR processors are
freeware, best downloaded from the web at
. In industry, you
can expect to pay anywhere from $50 to $400 for just the microcontroller and up to $1000 for a
professional compiler and programming interface!
SO BE CAREFUL AND RESPECTFUL
the microcontrollers and interface boards! Like any electronic device, they are
and may be
make connections with the power turned on! Always turn off the power
to the microcontroller before you disconnect any wires, too.