Introduction Application and programmer boards WinAVR Basic I/O ADC, timers USART, LCD
Mehul Tikekar Chiraag Juvekar Electronics Club September 29, 2009
What is a microcontroller?
It is essentially a small computer Compare a typical microcontroller (uC) with a typical desktop
ATmega16 Typical desktop
Clock frequency CPU data size RAM ROM
I/O
16MHz 8 bits 1KB 16KB
32 pins
3GHz 32 bits 1GB 160GB
Keyboard, monitor 65W
Power consumption 20mW
2
Why use a micro-controller?
It is programmable. A code (typically written in C) decides what it does Easier to write a code than design and make a custom circuit for complex jobs e.g. In a micromouse, a single uC controls the motors, finds distance from the walls, explores and solves the maze The same muC can be used in hundreds of applications http://instruct1.cit.cornell.edu/courses/ee476/Final Projects/ has 407 projects just on AVR microcontrollers as of 2009.
3
AVR microcontroller
• •
Lots of micro-controller families o 8051, PIC, AVR, MSP430, ARM, etc.
http://www.instructables.com/id/How-to-choosea-MicroController/ • AVR: Cheap, easy to use, fast and lots of features • ATmega16: o 16KB flash memory o 1KB SRAM o Up to 16MHz clock o Four 8-bit I/O ports o ADC, timers, serial interface, etc. o 40 pin DIP, VDD = 5V
4
ATmega16 pin diagram
Port B Programming interface
Port A
Port D
Port C
5
Hardware and Software needed
Application board Programmer board WinAVR
6
Bare bones of the Application Board
7
On a bread-board
IC1
R2 LED1 C1 R1 Programming interface
8
Complete application board
9
USBasp – USB Programmer
www.fischl.de/usbasp for more information and usb driver
10
USBasp
11
WinAVR
A complete package for Windows
◦Programmer’s Notepad (user interface) ◦avr-gcc (C/C++ compiler) ◦Mfile (makefile generator) ◦avrdude (programmer software)
Totally free! :