You are on page 1of 24

AVR Development Board Ver.

3 Users Guide Page 1 of 24

AVR Development Board Ver.3 - Users Guide

AVR Development Board Ver.3


Users Guide

Model No: AVR-DB-V3

Get Up-and-Running Quickly and


Start Developing Your Application on Today
AVR Development Board Ver.3 Users Guide Page 2 of 24

Thank you for purchasing our AVR development board.

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.

1. Introduction to AVR Development Board. 3


2. Introduction to AVR Microcontroller Series. 4
3. Introduction to AVR Tool Chain 8
4. Software Installation....10
5. Getting Started.11
6. LED Interfacing21
7. Precautions24
AVR Development Board Ver.3 Users Guide Page 3 of 24

Section 1

Introduction to AVR Development Board


A well designed development board is always essential for smooth development/experimentation
with microcontrollers. Every hobbyist must have some kind of development setup. Some people
use breadboard while others use general PCB to fabricate their development system.
Development is not very easy if bread boards or general PCB are used. If bread board is used,
after few days of use the wire will become loose or come out of the hole. While making large
circuit in a general PCB is a tedious job.

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:

LED and Switches


12V and 5V power supply
Buzzer
LCD display
Seven segment display
AVR Development Board Ver.3 Users Guide Page 4 of 24

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

Introduction to AVR Microcontroller Series


The AVR architecture was conceived by two students at the Norwegian Institute of Technology
(NTH) Alf-Egil Bogen and Vegard Wollan.

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

BASE BOARD DIAGRAM OF AVR DEVELOPMENT BOARD VER.3

Regulator BUZZER
Power supply

Relay Driver

RESET Motor
controller
Program
button
Serial
Port A connector

Port B

LCD
Port D

Port C

Microcon Seven Segment


troller Display

4x4 Switch LED


Keyboard Array Array
AVR Development Board Ver.3 Users Guide Page 6 of 24

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

AVRs are generally classified into five broad groups:

tinyAVR the ATtiny series


o 0.58 kB program memory
o 632-pin package
o Limited peripheral set

megaAVR the ATmega series


o 4256 kB program memory
o 28100-pin package
o Extended instruction set (Multiply instructions and instructions for handling
larger program memories)
o Extensive peripheral set

XMEGA the ATxmega series


o 16384 kB program memory
o 4464100-pin package (A4, A3, A1)
o Extended performance features, such as DMA, "Event System", and cryptography
support.
o Extensive peripheral set with DACs
AVR Development Board Ver.3 Users Guide Page 7 of 24

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.

FPSLIC (AVR with FPGA)


o FPGA 5K to 40K gates
o SRAM for the AVR program code, unlike all other AVRs
o AVR core can run at up to 50 MHz

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

Introduction to AVR Tool Chain


A lot of softwares are used with AVR development boards to write programs for
microcontrollers, compile them and to load them into the microcontrollers. To name a few there
are software like AVR GCC, Code Vision AVR, Pascal etc. which help in compiling the program
which is to written into the microcontroller. Next there are softwares like AVR ISP Programmer
and STK 500 to upload the program i.e. the .hex file into the microcontroller. Next there is
Atmel AVR Studio 5 which is the Integrated Development Environment (IDE) for developing
and debugging embedded Atmel AVR applications. The AVR Studio 5 IDE gives a seamless and
easy-to-use environment to write, build, and debug C/C++ and assembler code.

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.

Installing AVR GCC Compiler

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.

Getting Started with AVR GCC

First open Programmers Notepad and open a makefile.


Edit the makefile and make changes in target, FCPU value and source files according to
your requirements.
After saving the makefile, open a new file and write the C program in the file and save it.
AVR Development Board Ver.3 Users Guide Page 9 of 24

Then click on Tools and select Make All.


After that the compiler will run the C file and create .hex file in the same folder as the C
file.
This is the .hex file which should be written into the microcontroller.

Installing AVR Programmer

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.

Getting Started with AVR PROG

Double click on AVR Prog icon.


A small window opens with options like Program, Read and Verify.
Click on Browse and select the hex file which is to be written into the microcontroller.
Then click on Program which is present below Flash and not the one which is below
EEPROM.
After programming close the window and run the program.

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.

1. Run the Programmers Notepad (WinAVR)

2. Save the file by using .c extension


AVR Development Board Ver.3 Users Guide Page 12 of 24

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

4. After completion of the program go to Tools menu select MakeAll


option. It appears process exit code: 2 on the below showed output
screen.

5. Then run the MFile(WinAVR) go to Start Menu All programs


WinAVR MFile(WinAVR)
AVR Development Board Ver.3 Users Guide Page 14 of 24

6. Select the microcontroller from the list of supported microcontrollers


given in the compiler. Go to Makefile MCU type ATmega select
your atmega type no.

7. Go to Make file Output format ihex


AVR Development Board Ver.3 Users Guide Page 15 of 24

8. Go to Makefile\Debug format\AVR COFF (AVR Studio 3.x, VMLab <


3.10 [obsolete])

9. Select Makefile\Programmer \bsd


AVR Development Board Ver.3 Users Guide Page 16 of 24

10. Select Make file\Port\com1

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.

13. Type the F_CPU = 7372800


AVR Development Board Ver.3 Users Guide Page 18 of 24

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

16. After the compilation process Run the software AVRProg. Go to


C:\Program Files\Atmel\AVR Tools\AvrProg

17. Execute AVRProg \ Browse\Your project name (saved in HEX


format)
AVR Development Board Ver.3 Users Guide Page 20 of 24

18. Next click on the Flash\Program command button

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.

20. After the indication of Programming Ok on AVRProg press


the RESET button to execute the system.
AVR Development Board Ver.3 Users Guide Page 21 of 24

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.

Lets start with a simple task of switch on a LED.

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:

1. You write logic HIGH to the whole port.


This is done as follows:
DDRB = 0xFF;
DDRB implies to Data Direction Register of PORTB.
0xFF is in hexadecimal and in binary it is 1111 1111.
It means all 8 pins of PORT B are made as output pins.
But a disadvantage is that all the 8 pins become output port and they cant be used for any
other task ( i.e. to act as input pin ).
So we follow another method.

2. You write logic HIGH only to the particular pin.


This is done by using a standard function used to address a particular bit or pin in a
register. The function is _BV() and it is used as follows:
DDRB |=_BV( PB0 ) ;
AVR Development Board Ver.3 Users Guide Page 22 of 24

| 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.

PORTB = 0xFF ; or PORTB |=_BV( PBO ) ;


Thus LED is turned ON by giving logic HIGH to PORT B pin PB0 .

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.

PORTB = 0x00 ; or PORTB &=~_BV(PB0) ;


By writing 0x00 , the whole port i.e. all 8 pins will go LOW. So the second method is used.

& 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

The program for this is given.

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)

//MAIN Function Begins


int main(void)
{
LED_DDR |= _BV(LED_PIN); //Initialize port direction
LED_PORT &= ~_BV(LED_PIN); //Initialize port

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.

You might also like