Professional Documents
Culture Documents
Trademarks
All brand and product names mentioned herein are trademarks, services marks, registered trademarks, or
registered service marks of their respective owners and should be treated as such.
Table of contents
Topic Page No.
Section 1
Such problems are solved by using AVR Development Board. It is a circuit board with basic
connection required to drive the microcontroller and also with features like serial port, LCD
display, seven segment displays, prototyping area, power supply and it supports 40 pin AVR
microcontrollers.
A development board is very useful as you can program the microcontroller and also check the
outputs using the LEDs or LCD display or even connect it to the rest of the project using wires or
connectors. The power supply provided on the board can be used to supply power to other
circuits. The board also has provision to run DC motors or even stepper motors with the help of
motor driver ICs present on the board.
A very good advantage of such a development board is that all the basic project requirements are
present on the board and it also occupies less space even with all the modules like LCD and
seven segment displays.
The AVR development board has features which helps you in making and testing a project
involving a variety of modules like:
4 x 4 or 4 x 3 Keypad
Motor Driver IC
Serial Port
So one can say the AVR development board is the perfect circuit to design, make and test very
interesting and innovative projects
Section 2
The original AVR MCU was developed at a local ASIC house in Trondheim, Norway called
Nordic VLSI at the time, now Nordic Semiconductor, where the two founders of Atmel Norway
were working as student. It was known as a RISC (Micro RISC) and was available as silicon
IP/building block from Nordic VLSI. When the technology was sold to Atmel from Nordic VLSI,
the internal architecture was further developed by Alf and Vegard at Atmel Norway, a subsidiary
of Atmel founded by the two architects. The designers worked closely with compiler writers at
IAR Systems to ensure that the instruction set provided for more efficient compilation of high-
level languages. Atmel says that the name AVR is not an acronym and does not stand for
anything in particular. The creators of the AVR give no definitive answer as to what the term
"AVR" stands for. However, it is commonly accepted that AVR stands for Alf (Egil Bogen) and
Vegard (Wollan) 's Risc processor.
Among the first of the AVR line was the AT90S8515, which in a 40-pin DIP package has the
same pinout as an AVR microcontroller, including the external multiplexed address and data bus.
AVR Development Board Ver.3 Users Guide Page 5 of 24
Regulator BUZZER
Power supply
Relay Driver
RESET Motor
controller
Program
button
Serial
Port A connector
Port B
LCD
Port D
Port C
The polarity of the RESET line was opposite (AVR's having an active-high RESET, while the
AVR has an active-low RESET), but other than that, the pinout was identical.
The AVR is a modified Harvard architecture machine where program and data is stored in
separate physical memory systems that appear in different address spaces, but having the ability
to read data items from program memory using special instructions.
Basic families
Application-specific AVR
o megaAVRs with special features not found on the other members of the AVR
family, such as LCD controller, USB controller, advanced PWM, CAN etc.
32-bit AVRs
In 2006 Atmel released microcontrollers based on the new, 32-bit, AVR32 architecture. They
include SIMD and DSP instructions, along with other audio and video processing features. This
32-bit family of devices is intended to compete with the ARM based processors. The instruction
set is similar to other RISC cores, but is not compatible with the original AVR or any of the
various ARM cores.
All these microcontrollers have EEPROM, SRAM and flash memory and hence removing the
need for external memory in most cases. Almost all devices (except the smallest TinyAVR
chips) have serial interfaces, which can be used to connect larger serial EEPROMs or flash chips.
The data is usually stored in SRAM and the program is stored in the program memory. The
program memory is usually indicated in the naming of the device. For e.g. ATMEGA16 has 16K
bytes of program memory and similarly ATMEGA32 has 32K bytes. Sometimes if the data is
almost constant throughout the program then it can be stored in the flash memory and thus
SRAM space can be saved.
AVR Development Board Ver.3 Users Guide Page 8 of 24
Section 3
If a bootloaded microcontroller is used then AVR GCC compiler and AVR ISP programmer can
be used. A main advantage of AVR GCC over other compilers is that it is a freeware and is
easily available.
First go to AVR folder in the CD which is provider along with this manual.
Go to Compilers folder and open WinAVR.
Click on the setup file and install WinAVR.
After installation is complete, there will be WinAVR files like Programmers Notepad,
MakeFile etc. on the desktop.
First go to AVR folder in the CD which is provider along with this manual.
Go to Programmers folder and open AVR ISP Programmer.
Click on the setup file and install AVR Programmer.
After installation is complete, there will be a file AVR PROG on the desktop.
Bootloaded microcontroller :
If you are using a bootloaded microcontroller you can use AVR Prog or else you
have to use other softwares to program. Also to put the microcontroller in
programming mode, first press and hold PROG switch present on the development
board and at the same time press RESET switch once and release it. After that
release PROG switch.
AVR Development Board Ver.3 Users Guide Page 10 of 24
Section 4
Installing Softwares
Installing SDCC (Small Device C Compiler): is freeware ANSI C compiler that targets
WinAVR and many more.
Follow the same steps as guided in the previous section, except locate the below file
Development kit/compilers/sdcc/sdcc-2.7.0-setup
Installing AVR Prog is a pc tool for programming flash based Microcontroller Follow the same
steps as guided in the previous section, except locate the below file Development
kit/programmer/ AVRProg.exe
Section 5
AVR Development Board Ver.3 Users Guide Page 11 of 24
Getting started
After installing the software, to compile the program using WinAVR
software follow the below steps, figures will guide you.
3. Write all your program in the textbox appears on the screen and save
the file.
AVR Development Board Ver.3 Users Guide Page 13 of 24
11. Select Save as and save the file in the project folder with the name
Make file.
AVR Development Board Ver.3 Users Guide Page 17 of 24
12. Open the Make file in the compiler and make some changes as follows.
14. TARGET= LEDinterfacing (your file name) and save the file.
15. Finally compile the program by selecting (WinAVR) Make All in the
Tools menu. And it shows the Process Exit Code : 0 (on the output
screen).
AVR Development Board Ver.3 Users Guide Page 19 of 24
19. Then press & hold the PROG button in one finger and
consequently press & release the RESET button in another finger
finally release the PROG button.
Section 6
LED Interfacing
In this section you will be learning how to interface a LED and microcontroller. This is one of
the most basic projects that one can do using a microcontroller. By interfacing a LED properly
one can learn the basics like making a port input or output and assigning value to the port and
making a particular pin HIGH or LOW. By making user defined header files for simple projects
like this one can learn the basics of user defined header files.
To switch on a LED the first thing that should be done is , make the particular pin as output pin
and then a HIGH value should be given to the pin to which the LED is connected. How do we do
that ?
Its simple!
ATMEGA32 has 4 ports namely PORT A,B,C and D. Each port has 4 pins .All these ports can
be made input or output. So that means we have 32 input/output pins. Usually in all
developments boards a LED is connected to the 1st pin i.e. PORT B pin PB0.
Making the PORT as output or input is decided by the value written into the PORT DDR( Data
Direction Register). By writing logic HIGH (1) into this the particular port is made output and a
logic low(0) makes the port as input port.
So now the task is to make PORT B as output. This can be done in two ways:
| is logic OR operator. We know that anything OR operated with 0 will retain the
previous value and anything OR operated with 1 will always be 1.
So by performing OR operation on DDRB bit PB0, no matter what the previous value is ,
it becomes 1 , thus making it an output pin.
Now that the port or pin is made as output, it is time to write logic HIGH into the port and make
it give a logic HIGH i.e. +5V output to glow the LED.
This is also done in the same way as DDR, but the only difference is that instead of DDR we will
be using PORTB.
Similarly to switch OFF LED , the PORT is still output port but logic LOW should be written
into the port .
So DDRB will be the same and you need not write it again. Logic LOW is written into Port B
pin PB0.
& is AND operator. We know that anything AND operated with 1 will retain the previous value
and anything AND operated with 0 will always be 0. So by performing AND operation on PORT
bit PB0, no matter what the previous value is , it becomes 0 , thus only pin PB0 goes low.
So the LED is switched OFF by writing logic LOW into the Port.
Now that we learnt how to switch ON and switch OFF a LED, lets put it in a small program
such that the LED switches ON for some time an switches OFF for some time.
For this we need to use delay function. By giving a certain amount of delay after switching ON
the LED , the LED will remain ON for that much amount of time and then it can be switched
OFF and with a delay it will remain OFF for than much amount of time. And we will include
another parameter where the LED should switch ON and OFF for a certain number of times. We
will make a user defined function for that with number of time , On time and OFF time as
parameters.
AVR Development Board Ver.3 Users Guide Page 23 of 24
BlinkingLED.c: Demonstration of interfacing an LED designed for AVR running at 7.3728 MHz
Compile the program in WinAVR Compiler.
Operation: when loading program through programmer completes, LED blinks continuously at
the interval of 500ms.
-----------------------------------------------------------------------------*/
//Includes Definition of AVR
#include <avr/io.h>
#include <util/delay.h>
//Define Port/Pins
#define LED_DDR DDRB
#define LED_PORT PORTB
#define LED_PIN PB0
//Define Macros
#define LEDOn() LED_PORT |= _BV(LED_PIN)
#define LEDOff() LED_PORT &= ~_BV(LED_PIN)
for (;;)
{
LEDOn(); //makes LED on
_delay_ms(500); //delay of 1000ms
LEDOff(); //Makes LED off
_delay_ms(500); //delay of 1000ms
}
return 0;
}
AVR Development Board Ver.3 Users Guide Page 24 of 24
Section 10
Precaution
Please note that the AVR Development Board come without any case/box and all components are
exposed for finger touches and therefore extra attention must be paid to ESD (electrostatic discharge)
precaution.
Make it a habit always to first touch the metal surface of one of the USB or Ethernet
connectors for a few seconds with both hands before touching any other parts of the boards.
That way, you will have the same potential as the board and therefore minimize the risk for ESD.
Never touch directly on the AVR Development Board. The push-buttons on the AVR Development Board
have grounded shields to minimize the effect of ESD.