0% found this document useful (0 votes)
34 views

Avr Microcontroller

Embedded systems combine hardware and software to perform dedicated tasks. They are found in many everyday devices like traffic lights, DVD players, and digital clocks. An embedded system typically contains a microcontroller chip which integrates a processor core, memory, and input/output peripherals onto a single chip. The AVR ATmega8 is a common 8-bit microcontroller used in embedded systems. It has ports that allow input and output communication and can be programmed to blink an LED by setting the data direction registers and toggling the output values on the ports.

Uploaded by

Atish Subudhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Avr Microcontroller

Embedded systems combine hardware and software to perform dedicated tasks. They are found in many everyday devices like traffic lights, DVD players, and digital clocks. An embedded system typically contains a microcontroller chip which integrates a processor core, memory, and input/output peripherals onto a single chip. The AVR ATmega8 is a common 8-bit microcontroller used in embedded systems. It has ports that allow input and output communication and can be programmed to blink an LED by setting the data direction registers and toggling the output values on the ports.

Uploaded by

Atish Subudhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Embedded System

IS COMBINATION OF HARDWARE AND SOFTWARE


EMBEDDED SYSTEM
• “ An embedded system can be defined as those control
systems which are designed either by microprocessor or
microcontroller for a specific tasks. ”

• “ An embedded system is some combination of computer


hardware & software, either fixed in capability or
programmable, that is specifically designed for a particular
kind of application device. "
Embedded System In Daily Life

Moving message display Traffic Light


DVD player

Digital clock
Game
APPLICATION
.

INPUT OUTPUT

RAM ROM

MICROCONTROLLER
Microprocessor & Microcontroller

Microprocessor:
A silicon chip that contains a CPU. In the world of personal computers, the
terms microprocessor and CPU are used interchangeably. At the heart of all
personal computers and most of all automatic systems.

Microcontroller :
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small
computer on a single integrated circuit containing a processor core, memory,
and programmable input/output peripherals.
Basic Block Diagram of Microcontroller
AVR
A: Advance

V: Virtual

R:Risc
AVR
ATMEGA 8
MICRO-CONTROLLER
It was developed by Atmel Corporation

‘8’ in Atmega8 means this microcontroller has 8Kb of flash


memory

ALL AVR MC Is 8 bit microcontroller.

It was developed in the year 1996 by Atmel Corporation.


What is RISC?

 RISC stands for “Reduced Instruction Set Computer”

It is a very fast architecture which executes one instruction per clock
cycle.

RISC contains very small instruction set.

Programming is easy, but code length increases.


.
Some xtra FEATURES

• Up to 16 MIPS Throughput at 16 MHz


• 32 x 8 General Purpose Working Registers
• Six ADC channels in PDIP package
• Internal Calibrated Oscillator of 2,4,8 MHz.
MEMORY SEGMENTS
• 8K Bytes of Flash program memory
• 512 Bytes EEPROM (Electrically Erasable
Programmable Read Only Memory)
• 1K Byte Internal RAM (Random Access Memory)
Atmega8

PORTB-8ch 1.VCC
2.GND
PORTC-7ch 3.GND
4.AVCC
PORTD-8ch 5.AREF
total port pin:23
PORT
PORT is use for input and out put communication.

PORT are 8 bit wide.

PORT are bidirectional data bus.

Every PORT has three registers associated with it each one with 8 bit.
PORT IS 8 BIT REGISTERS.
PORT IS COMBINATION OF 8 FLIP FLOP
PORTB

PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0


PORTC

-------- PC6 PC5 PC4 PC3 PC2 PC1 PC0

PORTD
PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
PORT Associated Registers

DDRx – Data Direction Register

PORTx – Pin Output Register

PINx – Pin Input Register

where x = GPIO port name ( B, C or D)


DDRx register

DDRx (Data Direction Register) configures data direction of port pins. Means its
setting determines whether port pins will be used for input or output. Writing 0
to a bit in DDRx makes corresponding port pin as input, while writing 1 to a bit in
DDRx makes corresponding port pin as output.

DDRB= 0 0 0 0 0 0 0 0

PORTB is become input. DDRB=0b00000000

DDRB= 1 1 1 1 1 1 1 1

PORTB is become OUTPUT DDRB=0b11111111


PORTx register

 PORT give output voltage to external hardware.

 PORT is similar as printf .

PORTB=0b00000000
0 0 0 0 0 0 0 0

PORTB provide low (0) voltage to blub.


PORTx register

 PORT give output voltage to external hardware.

 PORT is similar as printf .

PORTB=0b11111111
1 1 1 1 1 1 1 1

PORTB provide high (5) voltage to blub.


PORTx register

 PORT give output voltage to external hardware.

 PORT is similar as printf .

PORTB=0b11000011
1 1 0 0 0 0 1 1

PORTB provide high (5) voltage to blub.


INTERFACING LED WITH ATMEGAX
 LED stands for "Light Emmiting Diode", It has 2 PINs one for +ve Source and the other one for Ground

 Basically 5mm LEDs work at 20mA and 3V


current. Now the question comes, How to get the
same Value of source from the MCU. Well,
actually Micro Controller can provide constant 5V
with 20mA Current through its PORTs(A to D)

 Lets calculate the Resistance Value, Our Requirements : 20mA , 3V


We Have : 20mA, 5V.So, we need to Decrese the Voltage by 2V. 
The Current Flowing in the Cct is 20mA.
V=IXR.
V = 2V.
I = 20mA.
R= ?
2= 0.020 X R 
=> R = 2 / 0.020
         = 100 Ohm.
LED BLINKING

STEP1:
Make Portb as output
DDRB=0b11111111
STEP2:
Provide +5v to LED.
PORTB=0b11111111
LED BLINKING
shifting
PORTB=0b00000001

PORTB=0b00000010

PORTB=0b00000100

PORTB=0b00001000

PORTB=0b00010000

PORTB=00100000
STEP1: WRITING CODE.

STEP2: COMPILE CODE.

STEP3: FLASH HEX FILE INTO AVR MICROCONTROLLER

COMPUTER
.hex file
Thanks........

You might also like