You are on page 1of 34

SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

MikroElektronika
Development tools - Books - Compilers

2 in 1
USB 2.0
IN-CIRCUIT

PROGRAMMER

ATMEL

AVR

DEVELOPMENT

BOARD

EasyAVR4
Users Manual

With useful implemented peripherals, plentiful practical


code examples and a broad set of additional add-on
boards (Serial Ethernet, Compact Flash, MMC/SD,
ADC, DAC, CAN, RTC, RS-485, etc.), MikroElektronika
development boards make fast and reliable tools that
can satisfy the needs of experienced engineers and
beginners alike.

Software and Hardware


solutions for Embedded World

EasyAVR4 Users Manual

MikroElektronika
Development
tools

Second edition
December 2006

No part of this manual, including the product and software described in it, may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language
in any form or by any means, except documentation kept buy the purchaser for backup purposes, without the express written permission of MikroElektronika company.
Product warranty or service will not be extended if the product is repaired, modified or
altered, unless such repair, modification or alteration is authorized in writing by
MikroElektronika.
MIKROELEKTRONIKA PROVIDE THIS MANUAL AS IS WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OR CONDITIONS OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PUROSE.
IN NO EVENT SHALL MIKROELEKTRONIKA, ITS DIRECTORS, OFFICERS, EMPLOYEES OR DISTRIBUTORS BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES(INCLUDING DAMAGES FOR LOSS OF PROFITS, LOSS
OF BUSINESS, LOSS OF USE OR DATA, INTERRUPTION OF BUSINESS AND THE
LIKE) EVEN IF MIKROELEKTRONIKA HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES ARISING FROM ANY DEFECT OR ERROR IN THIS MANUAL OR
PRODUCT.
SPECIFICATION AND INFORMATION CONTAINED IN THIS MANUAL ARE FURNISHED
FOR INTERNATIONAL USE ONLY, AND ARE SUBJECT TO CHANGE AT ANY TIME WITHOUT NOTICE, AND SHOULD BE CONSTRUED AS A COMMITMENT BY
MIKROELEKTRONIKA
MikroElektronika assumes no responsibility or liability for any errors or inaccuracies that
may appear in this manual, including the product and software described in it.
Product and corporate names appearing in this manual may or may not be registered trademarks or copyrights of their respective companies, and are used only for identification or
explanation and to the owners benefit, without intent to infringe.

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

CONTENTS

EasyAVR4 Users Manual

MikroElektronika
Development
tools

CONTENTS
CONNECTING THE SYSTEM

page 4

INTRODUCTION

page 5

DESCRIPTION OF THE DEVELOPMENT SYSTEM

page 5

Switches

page 6

Jumpers

page 7

MCU sockets

page 8

Power Supply

page 10

On-board USB 2.0 programmer

page 11

Oscillator

page 12

LEDs

page 14

Pushbutton switches

page 16

7-segment displays

page 19

Graphic LCD

page 20

LCD 2x16 in 4-bit mode

page 21

LCD 2x16 in 8-bit mode

page 22

RS-232 Communication

page 24

DS1820 Digital Thermometer

page 26

4.096V voltage regulator

page 27

Direct Port Access

page 29

JTAG connector

page 31

MMC/SD (Multimedia Card)

page 32
page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

CONNECTING THE SYSTEM

EasyAVR4 Users Manual

MikroElektronika
Development
tools

CONNECTING THE SYSTEM


The development system box contains the development system, product CD, USB cable,
RS232 cable and this manual.
Step no.1 The first thing to do is to take the system out of the box. Unpack the USB cable and connect it to the PC. Please use USB ports on the back of the PC with direct connection to the
motherboard.
Step no.2 Install the AVRprog programmer and drivers. Start the installation from the product CD:
CD_Drive:\product\zip\AVRprog_setup.exe.
Step no.3 After the installation connect the USB cable to the EasyAVR4 board. You will be asked for
the AVRprog drivers. Point to them in order to finish the driver installation. They are placed
in the folder:
System_Drive:\Program Files\Mikroelektronika\AVRFLASH\Driver.NT
Step no.4 Run and use AVRprog as explained in the document AVRprog programmer.
CD_Drive:\product\pdf\avrprog_manual.pdf.
After these 4 steps, your EasyAVR4 is installed and ready for use. You can try to read a program from the chip or to load an example from the examples folder of mikroElektronikas
compilers for AVR or from the product CD:
CD_Drive:\product\zip\easyavr4_examples.zip.

page

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

ATMEL

AVR

DEVELOPMENT

BOARD

INTRODUCTION
The EasyAVR4 development system is a full-featured development board for Atmel AVR
microcontrollers. It has been designed to allow students and engineers to easily exercise and
explore the capabilities of AVR microcontrollers. It allows AVR microcontrollers to be interfaced with external circuits and a broad range of peripheral devices, allowing a user to concentrate on software development.
Figure 1 illustrates the development board. Each component is marked on a silkscreen, both
top and bottom. These marks describe connections to the microcontroller, operation modes,
and provide some useful notes. The need for additional schematics is minimized since all
relevant information is printed on the board.
Figure 1.

EasyAVR4 development board

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

INTRODUCTION

EasyAVR4 Users Manual

MikroElektronika
Development
tools

SWITCHES

EasyAVR4 Users Manual

MikroElektronika
Development
tools

SWITCHES
The EasyAVR4 development board features a number of peripherial devices. In order to
enable these devices before programming, you need to check if appropriate jumpers or
switches have been properly set. Switches are devices that have two positions - ON and
OFF, which have a role to establish or break a connection between two contacts. The
EasyAVR4 development board has three groups of switches.
The first group, SW1, enables connections between the microcontroller port with analog
capabilities (PORTA) and external pull-up/down resistors. The pull-up/down resistors
should be disconnected from the analog input pins, otherwise they will affect the input voltage level. When PORTA pins are used as digital inputs/outputs, the appropriate pullup/down resistors should be enabled.
The second group, SW2, is used to enable LEDs connected to PORTA, PORTB, PORTC
and PORTD. For example, if the switch for PORTB is OFF, all PORTB LEDs will be turned
off.
The upper four switches of SW3 are used to enable SPI communication for interfacing with
MMC card. The lower four switches of SW3 are used to enable the 7-segment displays. If
you dont need the 7-segment displays in your project, these switches should be OFF.

ON

Group of 8 switches

1 2 3 4 5 6 7 8

Figure 2.

Switch 1 is ON, and other


switches are OFF

Switch is ON

Switch is OFF

page

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

JUMPERS
Jumpers, like switches, can break or establish a connection between two points. Beneath the
plastic cover of the jumper is a metal contact, which makes a connection if the jumper is
placed between two disconnected pins.
For example, the RS232 communication has two jumpers, J11 and J12, used as switches.
They are used to connect or disconnect Rx pin to PD0 and Tx pin to PD1 pin of the microcontroller. A connection is made when the jumpers are placed between two contacts.
Figure 3.
Jumper as a switch

Jumper is ON
Jumper is OFF

More often jumpers are used as a selector between two possible connections by using a three
pin connector. As illustrated in Fig. 4, the middle contact can be connected to the left or right
pin, depending on the jumpers position.
Figure 4.

All lines are


disconnected

Left line
is selected

Right line
is selected

Jumper as a
multiplexer

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

JUMPERS

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MCU SOCKETS

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MCU SOCKETS
EasyAVR4 is delivered with a ATmega16 40-pin microcontroller. Users can remove this one
and fit a different microcontroller in DIP40, DIP28, DIP20, DIP18, DIP14 or DIP8 packages
of an adequate pinout.

Figure 5.

MCU sockets

Note: There are two DIP40 sockets, with different pinouts (SKT1 and SKT2). When putting 40-pin microcontoller into DIP40 socket choose the one with corresponding pinout. For
example, ATmega8535 uses SKT2 socket, while ATmega8515 uses SKT1 socket.
Note: Since all packages have parallel connections, there must not be more than one microcontroller on the board at a time.
Note: Jumper J13 should be enabled only if you want to use DIP8 microcontroller with
external clock source.
page

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

Microcontrollers pins are routed to various peripherals as illustrated in Fig. 6. All ports have
direct connections to Direct Port Access connectors. Such connectors are typically used for
connecting external peripherals to the board or for providing useful points for connecting
digital logic probe.
All ports are connected to LEDs, push-button switches and pull-up/down resistors, which
allow easy monitoring and testing of digital pin state .
Some pins are connected to other peripherials such as the DS1820 temperature sensor, RS232 communication, 7-segment displays, LCD, etc.

SW2

PB5

VCC

VCC

ON

PORTB

CN2

1 2 3 4

PORTB

PB5

VCC

J2

PORTB

J6

PB5
PA0

PB0
PB1

PA1

PB2

PA2

PB4

PB5
PB6
PB7
RST

Figure 6.

System connection

VCC
GND
XT2

DIP40

PB3

PA3
PA4

DIP20
DIP28

PB5

PA5
PA6
PA7
AREF
AGND

PB5

AVCC
PC7

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

MCU SOCKETS

EasyAVR4 Users Manual

MikroElektronika
Development
tools

POWER SUPPLY

EasyAVR4 Users Manual

MikroElektronika
Development
tools

POWER SUPPLY

POWER SUPPLY

As a power supply source, users can select either a regulated supply from the USB cable
(default) or an external power supply. In case of the USB power supply, the system should
be connected to a PC using the USB programming cable, while the jumper J10 should be
set in the right-hand position.

SELECTABLE

In the case of an external power supply, the EasyAVR4 board produces +5V using an
LM7805 voltage regulator. The external power supply can be AC or DC, with a voltage
between 8V and 16V and the jumper J10 should be set in the left-hand position. In Fig. 7
you can see USB and external power supply connectors.
Figure 8. Power supply select jumper

Figure 7. USB and power supply connectors


J10 in the left-hand
position: system will
take power from the
external AC/DC
power adapter.
J10 in the right-hand
position: system will
take power from the
USB cable.

USB
connector

External power
supply connector
CN7
1
2

REG1
7805

USB

USB Power Supply

EXT

USB

External Power Supply

USB

EXT

8-16V (AC/DC)

EXT

Vin

Vout

J14

5V

FP1

5V

GND
2
E1
470uF

C1
100nF

Figure 9. J10 is set to USB power supply

C2
100nF

E3
470uF

C9
100nF

VCC

VCC
DD+
GND

USB

USB
connector

page

10

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

USB 2.0
IN-CIRCUIT

PROGRAMMER

ON-BOARD USB 2.0 PROGRAMMER


There is no need for the use of external
equipment during programming, as the
EasyAVR4 development system has its
own on-board USB 2.0 programmer.
All you need to do is connect the system
to a PC using the USB cable. Then, load
your program into the microcontroller
via the AVRprog programming software,
which is supplied with the board.
Figure 10. On-Board USB programmer

Note: There is no need for manually reseting MCU after programming. The programmer
will reset the MCU automatically.
VCC

1K

POWER

VCC

VCC

10K

USB LINK

PA1
PA2

PB3

PA3

PB5
PB6
PB7
RST

VCC
OSCILLATOR

VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

PB2

PB4

AVRprog
On-Board USB
programmer

PA0

PB0
PB1

PA4
PA5
PA6
PA7
AREF

TO PERIPHERALS
ON DEVELOPMENT BOARD

Reset

100n

1K

SWITCH

VCC CN8
1
VCC
2
D3
D+
4
27
GND

27

USB

USB CONN.

AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 11. Switch schematic


page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

11

ON-BOARD USB PROGRAMMER

EasyAVR4 Users Manual

MikroElektronika
Development
tools

OSCILLATOR

EasyAVR4 Users Manual

MikroElektronika
Development
tools

OSCILLATOR
EasyAVR4 development board has on-board oscillator circuit for generating microcontrollers clock input. Within the AVRprog programmer you can either choose internal RC
oscillator or external clock. External oscillator is connected to the XT1 pin of the microcontroller. Microcontroller in DIP8 package doesnt have pin that is dedicated only for the
oscillator clock input. Because of the small pin count, it has PB4 pin multiplexed between
I/O and clock input function.
Oscillator

Figure 12.

If you want to use pin PB4 with I/O function you should use internal RC oscillator. If you
dont need I/O function of the PB4 pin, then you can use on-board oscillator by enabling
jumper J13. By doing this, you are making a direct connection between the oscillator circuit
and PB4 pin.
Note: Jumper J13 should be enabled only if you want to use DIP8 microcontroller with
external clock source.

page

12

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

Figure 13. Oscillator connection with MCU

PA1

PB2

PA2

PB3

PA3

PB4

10K

PB6
PB7
RST

PB4

J13

VCC
GND

100n

Reset

VCC

XT2
XT1
PD0
PD1
PD2

74HC04

PD3

VCC

VCC

R7 1M

ATMEGAxxxx

PB1

PB5

OSCILLATOR

PA0

PB0

VCC

OSCILLATOR

EasyAVR4 Users Manual

MikroElektronika
Development
tools

PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

E
C
D

R8
1K

GND

C11
22pF

C12
22pF

X2
8MHz

OSCILLATOR

Note: In order to simplify the schematics in this manual, the oscillator circuit is represented by this symbol.

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

13

LEDs

EasyAVR4 Users Manual

MikroElektronika
Development
tools

LEDs
Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pins digital state. EasyAVR4 has 32 LEDs that are connected to the microcontrollers PORTA, PORTB, PORTC and PORTD.
Figure 14.

Light Emitting Diodes

Each group of eight LEDs can be enabled or disabled using the switch SW2. Fig. 15. illustrates the connection of a LEDs to PORTA of the microcontroller. A resistor is used in series
with the LED to limit the LED's current. In this case the resistor's value is 1K.

page

14

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

EasyAVR4 Users Manual

MikroElektronika
Development
tools

The LEDs are enabled when the corresponding switch on SW2 is on. When enabled, LEDs
will display the state of the corresponding microcontroller pin; otherwise the LEDs will
always be off, no matter what the port state is, as no current can flow through LED.

LED schematic Figure 15.


ON

1 2 3 4

PORTA LED
PORTB LED

CURRENT FLOW

PORTC LED
PORTD LED

PA0
PA1

RN6
1
2
3
4
5
6
7
8
9

PA3
PA4

PA6

PB1

PA1

PB2

PA2

PB3
PB4

PA7

PB5
PB6

VCC

PA0

PB0

PA5

PB7
10K

VCC
OSCILLATOR

100n

Reset

RST
VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

R-SIL 8/9
10K

PA2

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

15

MikroElektronika
Development
tools

PUSHBUTTON SWITCHES
EasyAVR4 has 32 push buttons, which can be used
to change states of digital inputs to microcontroller's
ports. There is also one switch that acts as a RESET.
Reset switch schematic is shown in Figure 17.

PA0

PB0

Figure 16. Reset switch


Figure 17.

PA1

PB2

PA2

PB3
PB4

VCC

Reset switch schematic

PB5
PB6

10K

AVRprog
On-Board USB
programmer

PB7
RST

VCC
OSCILLATOR

100n

Reset

PB1

VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

PUSHBUTTON SWITCHES

EasyAVR4 Users Manual

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 18.
Pushbutton switches

page

16

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

Buttons connections to PORTA, PORTB, PORTC and PORTD are shown in Fig. 19. Jumper
J6 determines whether a button press will bring logical zero or logical one to the appropriate pin.
When button is not pressed, pin state is determined by the pull-up or pull-down port
jumpers.
In the example shown in Fig. 19, J6 is connected to +5V, therefore pressing the buttons will
bring logical one to the appropriate pins.

PORTA
RA0

PORTB

PORTC

RB0

RC0

PORTD

RB1

RC1

RD1

RA2

RB2

RC2

RD2

RC4

RB5

RC5

PB7

RD3

RD4

RST

RD5

VCC
OSCILLATOR

100n

RB4

PA3

PB6

10K

RA5

RC3

PA2

PB3

PB5

Reset

RA4

RB3

PB2

PB4

VCC

RA3

VCC
GND
XT2
XT1
PD0

RA6

RB6

RC6

RD6

RA7

RB7

RC7

RD7

PD1
PD2
PD3

0V while button
is pressed

VCC

PA1

PB1

ATMEGAxxxx

RA1

PA0

PB0

RD0

PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

+5V while button


is pressed

J6

Figure 19.
Buttons schematic

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

17

PUSHBUTTON SWITCHES

EasyAVR4 Users Manual

MikroElektronika
Development
tools

EasyAVR4 Users Manual

MikroElektronika
Development
tools

PUSHBPUSHBUTTON SWITCHES

On Fig. 20 the J1 jumper is set


to pull-up, therefore when the
button is not pressed, pull-up
resistor pulls the microcontrollers PA3 pin to +5V.

vcc
J1
PORTA

pull-up

ON

PB0

PA0

PB1

PA1

PB2

PA2

PB3

PA3

PB4

PB5
PB6
PB7
RST

VCC

VCC
GND
XT2

ATMEGA

Thus, only when the button is


pressed the microcontroller
will sense a logical zero; otherwise the pin state will always
be logical one.

SW1

A button press causes the port


pin to be connected to ground
(J6 is in the lower position).

1 2 3 4 5 6 7 8

PA4
PA5

PA3

PA6
PA7
AREF

vcc

AGND

J6

AVCC

0V while pressed

PC7

Figure 20. Button with pull-up resistor

On Fig. 21 the J6 jumper is set


to pull-down, therefore when
the button is not pressed, pulldown resistor pulls the microcontrollers PA3 pin to 0V.

vcc
J1
PORTA

ON

SW1

A button press causes the port


pin to be connected to +5V (J6
is in the higher position).

PB1

PA2

PB3

PA3

PB4

PB6
PB7
RST

VCC

PA1

PB2

PB5

VCC
GND
XT2

1 2 3 4 5 6 7 8

PA0

PB0

ATMEGA

Thus, only when the button is


pressed the microcontroller
will sense a logical one; otherwise the pin state will always
be logical zero.

pull-down

PA4
PA5

PA3

PA6
PA7
AREF
AGND
AVCC

vcc

J6

PC7

5V while pressed

Figure 21. Button with pull-down resistor

page

18

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

EasyAVR4 Users Manual

MikroElektronika
Development
tools

8.

7
S
E
G

7-SEGMENT DISPLAYS

R
E
A
D
Y

EasyAVR4 has four 7-segment displays in multiplex mode. Data lines are connected to
PORTA, while each display is enabled through the lower four bits of PORTB.
Figure 22.
7-segment displays

8.
a

DIS3

dp

R2 - R9
PA0

PB0
PB1

PA1

PB2

PA2

PB4
PB5

10K

PB6
PB7

OSCILLATOR

100n

Reset

RST

VCC

VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

PB3

VCC

PA3

PA5
PA6

DIS0

AREF

10

8 7 6

10 9

8 7 6

10

8 7 6

10 9

8 7 6

3 4 5

3 4 5

3 4 5

3 4 5

AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

dp

PA7

DIS1

8. 8. 8. 8.

a
b
c
d
e
f
g

PA4

DIS2

Q1
R28
10K

PD7

Q3

Q2
R29
10K

R30
10K

Q4
R31
10K

SW3

ON

PB1
PB0

1 2 3 4 5 6 7 8

PB7
PB6
PB5
PB4
PB3
PB2

SCK
MISO
MOSI
MMC-CS
DIS3
DIS2
DIS1
DIS0

Figure 23. 7-segment displays schematic


page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

19

GRAPHIC LCD
CONNECTOR

ON-BOARD

MikroElektronika
Development
tools

GRAPHIC LCD
A graphic LCD (GLCD) allows advanced visual messages to be displayed. While a character LCD can display only alphanumeric characters, a GLCD can be used to display messages in the form of drawings and bitmaps. The most commonly used graphic LCD has the
screen resolution of 128x64 pixels. Before a GLCD is connected, the user needs to set the
jumper J8 (Fig. 24) to the upper position. The GLCDs contrast can be adjusted using the
potentiometer P1, which is placed to the right of the GLCD.

Figure 24.
GLCD selection jumper
In order to enable GLCD,
jumper J8 should be set to
the upper position, labeled
as GRAPH.

GLCD

Figure 25.

J8

GRAPH.
CHAR.

Vee

GLCD contrast
selected

LCD8 contrast
selected

GLCD and LCD8


contrast not selected

VCC
VCC

PA0
PA1

R19 10

Vo

PB3

VCC

PB4

VCC

PB5

RST

VCC

VCC

OSCILLATOR

GND

100n

20

Reset

PB7

PD4
PD5
PD6
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PD7

PD2
PD3

10K

PB6

XT2

Figure 26.

XT1
PD0

GLCD schematic

CS1
CS2

PD1
PD2
PD3

RS
R/W
E

PA2

ATMEGAxxxx

P1 10K

Contrast
Adjustment

PB0
PB1
PB2

CS1
CS2
GND
VCC
Vo
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
RST
Vee
LED+
LED-

GRAPHIC LCD 128X64

EasyAVR4 Users Manual

PA3
PA4
PA5
PA6
PA7

D0
D1
D2
D3
D4
D5
D6
D7

AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

RST

page

20

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

2x16 LCD

CONNECTOR
2x16 LCD

ON-BOARD

LCD 2X16 IN 4-BIT MODE


A standard character LCD is probably the most widely used data visualization component.
Usually, it can display two lines of 16 alphanumeric characters, each made up of 5x8 pixels. The character LCD communicates with the microcontroller via a 4-bit or 8-bit data bus,
each requiring the use of a different connector on EasyAVR4. For 4-bit data bus use, the
LCD should be placed in the upper left of the board, just above the LEDs. The connection
to the microcontroller is shown in Fig. 28 where there are only four data lines. It is important to note that the LCD should be placed or removed from EasyAVR4 only when the
power is off.

Figure 27.
LCD 2x16 in 4-bit mode

PA0

PB0
PB1

PA1

PB2

PA2

PB4
PB5

10K

PB6
PB7

VCC

VCC

OSCILLATOR

GND

100n

Reset

RST

XT2
XT1

PD4
GND
PD6
GND
GND
GND
GND
PA4
PA5
PA6
PA7

P2
10K

Contrast
Adjustment

PD0
PD1

14
GND
VCC
VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7

Figure 28.

PD2
PD3

LCD 2x16 in 4-bit


mode schematics

RS

LCD Display
4-bit mode

PD4

ATMEGAxxxx

PB3

VCC

VCC

PA3
PA4
PA5
PA6
PA7

D4
D5
D6
D7

AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2
PC1

PD5

PC0

PD6

PD7

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

21

LCD 2X16 IN 4-BIT MODE

EasyAVR4 Users Manual

MikroElektronika
Development
tools

LCD IN 8-BIT MODE

EasyAVR4 Users Manual


2x16 LCD

CONNECTOR
2x16 LCD

ON-BOARD

MikroElektronika
Development
tools

LCD 2X16 IN 8-BIT MODE


When using a character LCD in 8-bit mode, the connector that is shared with the GLCD
should be used. Since this connector has 20 pins and the character LCD has only 14 pins,
special attention is required when placing the LCD. Otherwise the LCD can be permanently damaged.
Figure 29.
LCD 2x16 in 8-bit mode

View from the back:


shows which pins
stays disconnected.

The LCD must be placed in the marked position with two free pins to the left and four free
pins to the right. It is important to note that the LCD should be placed or removed from
EasyAVR4 only when the power is off. Before attaching the LCD, set jumper J8 to the lower
position. The LCD's contrast can be adjusted using potentiometer P1 which is located to the
right of the GLCD/LCD connector.
NOTE: Special attention is required when placing the LCD. Otherwise the LCD can be permanently damaged.

page

22

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

In order to enable LCD,


jumper J8 should be set to
the lower position, labeled
as CHAR.

J8

GRAPH.

Vee

GLCD contrast
selected

LCD8 contrast
selected

GLCD and LCD8


contrast not selected

VCC

CHAR.

VCC

PA1

PB2

PA2

PB3

Leave four free pins


to the right side

Vo

PB4

VCC

PB5
10K

PB6

PD4
PD5
PD6
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7

PB7

VCC

VCC

OSCILLATOR

GND

100n

14

Reset

RST

GND
VCC
VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7

Leave two free


pins to the left side

PA0

PB1

XT2
XT1

LCD Display
8-bit mode

PD0
PD1
PD2
PD3
RS
R/W
E

ATMEGAxxxx

P1 10K

Contrast
Adjustment

PB0

PA3
PA4
PA5
PA6
PA7

D0
D1
D2
D3
D4
D5
D6
D7

AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 30. LCD 8-bit mode schematic

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

23

LCD 2X16 IN 8-BIT MODE

EasyAVR4 Users Manual

MikroElektronika
Development
tools

R S- 2 3 2 C O M M U N I C A T I O N

EasyAVR4 Users Manual

MikroElektronika
Development
tools

RS232 RS-232 COMMUNICATION


ENABLED

RS-232 communication enables point-to-point data transfer. It is commonly used in data


acquisition applications, for the transfer of data between the microcontroller and a PC. Since
the voltage levels of a microcontroller and PC are not directly compatible with each other,
a level transition buffer such as the MAX232 must be used.

Figure 31. RS232 connectors

In order to provide a more flexible system, the microcontroller is connected to the MAX232
through the two jumpers: J11 and J12. The jumper J11 is used to connect the Rx line to PD0
pin. The jumper J12 is used to connect the Tx line to PD1 pin.

page

24

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

Figure 32.
Connection between microcontroller and a PC
PC
6

RS-232
CON

CONNECT
MCU TO PC

Receive
data (Rx)

SERIAL
CABLE
CONNECT
PC TO MCU
6

RS-232 A
CON

CN9
SUB-D 9p

4
9
5

2
7
3

Send
Data (Tx)

VCC

C18
100nF

E12
10uF

C2+
C2VS-

T2OUT
R2IN

VCC
GND
T1OUT
R1IN
R1OUT
T1IN
T2IN
R2OUT

16
15
14
13
12
11
10
9

PB5
PB6
PB7
RST

J12

J11
Rx
Tx

VCC
OSCILLATOR

100n

C1-

PA2

PB4

10K

VS+

PA1

PB2
PB3

VCC

Reset

E10
10uF

C1+

MAX232

E11
10uF

1
2
3
4
5
6
7
8

PB1

VCC
GND
XT2
XT1
PD0
PD1
PD2

RS232 COMM.
Disabled

RS232 COMM.
Enabled

PD3

ATMEGAxxxx

VCC

U6
E9
10uF

PA0

PB0

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

25

R S- 2 3 2 C O M M U N I C A T I O N

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MikroElektronika
Development
tools

DS1820 DIGITAL THERMOMETER


DS1820 digital thermometer is well suited to environmental temperature measurement, having the
temperature range of -55C to 125C and the accuracy of +/-0.5C. It must be placed correctly in the 3pin socket provided on EasyAVR4, with its rounded
side to the lower edge of the board (see Fig. 33) otherwise the DS1820 could be permanently damaged.
DS1820s data pin can be connected to either PC6 or
PC7 pin, which is determined by jumper J7.
Figure 33.
There is a mark in
the form of half-circle for proper orientation of DS1820
sensor.

DS1820
PA1

PB2

PA2

PB3

125 C

PB4

VCC

PB5
10K

PB6
PB7

-55 C
VCC

DS1820

VCC
OSCILLATOR

100n

Reset

RST
VCC
GND
XT2
XT1
VCC

GND

PA0

PB0
PB1

VCC

PD0
R1
10K

PD1
PD2
PD3

DQ

J7

ATMEGAxxxx

DS1820 DIGITAL THERMOMETER

EasyAVR4 Users Manual

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 34.
DQ line is
connected to PC6

DQ line is
connected to PC7

DQ line is
disconnected

DS1820 schematic

page

26

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

VREF
4.096V

ON-BOARD

4.096V VOLTAGE REFERENCE


Some of the Atmels microcontrollers have integrated A/D Converter (Analog-to-Digital
Converter). In order for A/D Converter to work, voltage reference must be used. It represents a maximum value that can be measured by microcontroller. EasyAVR4 uses 4.096V
voltage reference because number 4096 is a power of 2 which makes it easy to represent values as binary numbers in microcontroller. In case of the 10-bit A/D Converter the resolution
will be 4mV per bit. In case of the 12-bit A/D Converter the resolution will be 1mV per bit.
Figure 35.
4.096V voltage reference

Analog input pins are placed on PORTA of microcontroller. In order to measure analog signal without interference, turn the coresponding switch on SW1 to OFF position. This will
disable connection of the used PORTA pin to the pull-up/down resistors.
Applications of A/D Conversion are various. Microcontroller takes analog signal from its
input pin and translates it into a digital value. Basically, you can measure any analog signal
that fits in range acceptable by MCU. With 4.096V voltage reference used (jumper J9 in
lower position) this range is 0V-4.096V. If you place jumper J9 in upper position 5V will be
used as voltage reference and therefor measure range will be 0V-5V.

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

27

4.096V VOLTAGE REFERENCE

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MikroElektronika
Development
tools

Pull-up/down resistors on
PORTA analog input pins
should be disabled using
SW1
vcc

VCC

J1
PORTA

pull-up

R12
1K

J9

REF1

ON

SW1

AREF

VCC

MCP
1541

E14
10uF

3 VOUT

VIN 1
GND 2

R11
100

PB0

PA0

PB1

PA1

PB2

PA2

PB3
PB4

VCC

PB5
10K

PB6
PB7

5V voltage
reference

VCC
OSCILLATOR

100n

4.096V voltage
reference

Reset

RST
VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

4.096V VOLTAGE REFERENCE

EasyAVR4 Users Manual

PA3
PA4
PA5
PA6
PA7

1 2 3 4 5 6 7 8

ADC0
ADC1
ADC2
ADC3
ADC4
ADC5
ADC6
ADC7

AREF
AGND
AVCC

VCC

PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 36.
4.096V voltage reference schematic

page

28

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

DIRECT PORT ACCESS


All microcontroller input/output pins can be accessed via connectors placed along the right
side of the board. For each of PORTA, PORTB, PORTC, PORTD and PORTE there is one
10-pin connector providing VCC, GND and up to eight port pins.

Figure 37. Direct port access connectors

These connectors can be used for system expansion with external boards such as Serial
Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485, etc. Ensure that the
on-board peripherals are disconnected from microcontroller by setting the appropriate
jumpers, while external peripherals are using the same pins. The connectors can also be used
for attaching logic probes or other test equipment.
Figure 38.
Example of how to connect
external peripheral with flat
cable

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

29

DIRECT PORT ACCESS

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MikroElektronika
Development
tools

Pull-up line is
connected

VCC

J3

2
3

RN3

Pull-down line
is connected

All lines
are disconnected

1
PC0 2
PB0

PA0

PB1

PA1

PB2

PA2

PC3 5

PB3

PA3

PC4
PC5
PC6
PC7

PB4

VCC

PB5
10K

PB6
PB7

VCC
OSCILLATOR

100n

Reset

RST
VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

DIRECT PORT ACCESS

EasyAVR4 Users Manual

PA4
PA5
PA6

PC1 3
PC2 4
6
7
8
9

PA7
AREF
AGND

RPACK8/9
8x10K

AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

Figure 39.
PORTC connection

CN3
PC0

PC1

PC2

PC3

PC4

PC5

PC6

PC7

VCC

HEADER 5x2

page

30

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

JTAG CONNECTOR
JTAG connector can be used as serial programming interface or On-Chip debug system. For
the On-chip Debug system, in addition to the JTAG interface pins, the RESET pin is monitored by the debugger to be able to detect external reset sources. The debugger can also pull
the RESET pin low to reset the whole system. The JTAG interface is accessed through four
of the microcontrollers pins:
- TMS: Test Mode Select,
- TCK: Test Clock,
- TDI: Test Data In,
- TDO: Test Data Out.
PA0

PB0
PB1

PA1

PB2

PA2

PB4
PB5

10K

PB6
PB7
RST

VCC
OSCILLATOR

100n

Reset

mRST

VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

PB3

VCC

PD4

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3

JTAG
CONNECTOR

PC2
PC1

PD5

PC0

PD6

PD7

VCC

Figure 40.

VCC

CN6
TCK

GND

TDO

VTref

TMS

nSRST
nTRST

Vsupply
TDI

mRST
NC

GND

JTAG connector schematic


HEADER 5x2

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

31

JTAG CONNECTOR

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MMC/SD (MULTIMEDIA) CARD

EasyAVR4 Users Manual

MikroElektronika
Development
tools

MMC/SD MMC/SD (MULTIMEDIA CARD)


MASS STORAGE
256MB

SUPPORTED

MMC card is used as storage media for a portable devices, in a form that can easily be
removed for access by a PC. For example, a digital camera would use an MMC card for
storing image files. With an MMC reader (typically small box that connects via USB or
some other serial connection) you can easily transfer data from MMC card to your computer. Microcontroller on EasyAVR4 communicates with Multi Media Card via SPI communication.
Modern computers, both laptops and desktops, often
have SD slots, which can
read MMC cards.

Figure 41.
MMC slot on-board

To enable MMC card you must turn on switches 1, 2, 3 and 4 on SW3. By doing that, microcontrollers SPI comunnication lines (SDI, SDO and SCK) and Chip Select are connected to
MMC. Working voltage of EasyAVR4 is 5V DC, while working voltage of MMC card is
3.3V DC. Because of that, there is a voltage regulator on-board with MMC card
(MC33269DT-3.3). Data lines from microcontroller to MMC card must be also adjusted to
3.3V. It is done with resister voltage dividers as shown on Figure 42.

page

32

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

MMC/SD (MULTIMEDIA CARD)

EasyAVR4 Users Manual

MikroElektronika
Development
tools

SPI-SDI
MMC-CS#
SPI-SDO
SPI-SCK
R13
2K2

R15
2K2

VCC3

R17
2K2

CN12
1
2
3
4
5
6
7

R14
3K3

R18
3K3

R16
3K3

MC33269
DT-3.3

C19
100nF GND
1
2

C20
100nF

MMC/SD
CARD

REG2

VCC

VCC3

CS
Din
GND
+3.3V
SCK
GND
Dout

VCC

VIN

VOUT

VCC3

E15
10uF

SW3

MMC-CS#

ON

SPI-SDI
SPI-SDO

PB7

PA0

PB0

PB6
PB5
PB4

PB1

PA1

PB2

PA2

PB3
PB4

VCC

PB5
10K

PB6
PB7

VCC
OSCILLATOR

100n

Reset

RST
VCC
GND
XT2
XT1
PD0
PD1
PD2
PD3

ATMEGAxxxx

1 2 3 4 5 6 7 8

SPI-SCK

PA3
PA4
PA5
PA6
PA7
AREF
AGND
AVCC
PC7
PC6
PC5
PC4
PC3
PC2

PD4

PC1

PD5

PC0

PD6

PD7

MMC schematic Figure 42.

page

USB

EasyAVR

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

33

EasyAVR4 Users Manual

MikroElektronika
Development
tools

If you are experiencing problems with any


of our products or you just want additional
information, please let us know. We are
committed to meeting your every need.
Technical Support :
support@mikroe.com
If you have any other question, comment
or a business proposal, please contact us:
E-mail: office@mikroe.com
Web:
www.mikroe.com
Forum: www.mikroe.com/forum/
page

34

USB

MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD

EasyAVR

You might also like