SlideShare uma empresa Scribd logo
1 de 9
EMBEDDED SYSTEMS TUTORIAL6- INTERFACING 7
SEGMENT DISPLAY WITH AVR
Hii… friends its our next AVR tutorial this time we are going to discuss about interfacing of 7 segment
display with a AVR. You must have seen 7 segment display in you house hold inverters, in a zerox
machine or even on your microwave oven. So in this tutorial , We will discuss about 7 segment display ,
its types and its interfacing with AVR along with source code so have a look…

INTROUCTION
A seven segment display is the most basic electronic display device that can display digits from 0-9.
They find wide application in devices that display numeric information like digital clocks, radio, microwave
ovens, electronic meters etc. The most common configuration has an array of eight LEDs arranged in a
special pattern to display these digits. They are laid out as a squared-off figure ‘8’. Every LED is assigned
a name from 'a' to 'g' and 'dp'and is identified by its name. Seven LEDs 'a' to 'g' are used to display the
numerals while eighth LED 'dp' is used to display the dot/decimal.

PACKAGE AND TYPES

A seven segment is generally available in ten pin package. While eight pins correspond to the eight
LEDs, the remaining two pins (at middle) are common and internally shorted. These segments come in
two configurations, namely, Common cathode (CC) and Common anode (CA). In CC configuration, the
negative terminals of all LEDs are connected to the common pins. The common is connected to ground
and a particular LED glows when its corresponding pin is given high. In CA arrangement, the common pin
is given a high logic and the LED pins are given low to display a number .
HOW IT WORKS
Now let us suppose a digit is to be displayed on the 7 segment. Suppose the digit is 1 in
such case LEDS corresponding b and c should glow, so we can say foe each and every
digit a specific set of LEDs has to glow . the LEDs to be golw with corresponding digits
Are as shown.
INTERFACING WITH AVR MICROCONTROLLER
Here is step wise process for inTERfacing a 7 segment display with AVR
microcontroller( ATMEGA 16)
SETP 1
CICUIT CONNECTION
Here we are using a common anode 7 segment display.
Connect your 7 segment display with the atmega 16 as per the connections shown in
the diagram below
STEP 2
SOURCE CODE
Create the new project in AVR STUDIO4 and compile the code written below-

/*
A simple program for interfacing common anode seven segment display with AVR
microcontroller
a->PD7
b->PD6
c->PD5
d->PD4
e->PD3
f->PD2
g->PD1
DP->PD0
Written

by:

ABHILASH

DIXIT
TECH_STRONG

*/
#include

<avr/io.h>

#include

<util/delay.h>

// You can change the 7 segement display port just by changing the port in this macro
#define

SEVEN_SEGMENT_PORT

PORTC

#define

SEVEN_SEGMENT_DDR

DDRC

void

Seven_Segment_display(uint8_t

n,uint8_t

dp)

{
/*
This
the
Note:

function
decimal

writes

a
point

digit

given
is

by

n

displayed

to

the
if

display
dp=1
n

must

be

less

than

9

*/
if(n<10)
{
switch

(n)
{

case

0:

SEVEN_SEGMENT_PORT=0b00000011;
break;
case

1:

SEVEN_SEGMENT_PORT=0b10011111;
break;
case

2:

SEVEN_SEGMENT_PORT=0b00100101;
break;
case

3:

SEVEN_SEGMENT_PORT=0b00001101;
break;
case

4:

SEVEN_SEGMENT_PORT=0b10011001;
break;
case

5:

SEVEN_SEGMENT_PORT=0b01001001;
break;
case

6:

SEVEN_SEGMENT_PORT=0b01000001;
break;
case

7:

SEVEN_SEGMENT_PORT=0b00011111;
break;
case

8:

SEVEN_SEGMENT_PORT=0b00000001;
break;
case

9:

SEVEN_SEGMENT_PORT=0b00001001;
break;
}
if(dp)
{
//if

decimal

point

//make

should
0th

be

displayed

bit

Low

SEVEN_SEGMENT_PORT&=0b11111110;
}
}
else
{
//This

symbol
//so

on

display
display

tells

that
can't

n

was

greater
handle

than

9
it

SEVEN_SEGMENT_PORT=0b11111101;
}
}

void
{

Wait()
//

An

approx

one

second

delay

for

1Mhz

CPU

uint8_t

clock
i;

for(i=0;i<1302;i++)
{
_delay_loop_2(0);
}
}

void

main()

{
//Setup
SEVEN_SEGMENT_DDR=0xFF;
SEVEN_SEGMENT_PORT=0xFF;
uint8_t

//All
//All

output

segments

off
count=0;

while(1)
{
Seven_Segment_display(count,0);
count=count+1;
if(count>9)
{
count=0;
}
_delay_ms(300);
}
}
In this program first we have created a function to display digits named
seven_segment_display, then we have passed two argument first to display numbers
and other to display decimal point if we want. We are going to connect our 7 segment at
PORT C, so we will make it output port and after that the corresponding pins connected
to 7 segment pins are set to high or low according to number to be displayed. This
program will display the no from 0 t0 9 and as it reaches to 9 , it will be reset to 0. You
can change numbering sequence or display only odd or odd number or whatever you
want just by some small changes in the source code according to your task.
Now burn the microcontroller with the hex file generated and power up your
circuit , you will see numbers displaying from 0 to 9.

So we have learnt the basics of 7 segment display interfacing, we can more 7 seven
segment display with a AVR but for that we will need multiplexing technique, we will
discuss multiplexing in upcoming tutorials but before that we have to discuss about
TIMER in AVR so in next tutorial we will discuss about TIMER s

Mais conteúdo relacionado

Semelhante a Est 6

Ppt on interfacing led and 7 segment with 8951
Ppt on interfacing led and 7 segment with 8951 Ppt on interfacing led and 7 segment with 8951
Ppt on interfacing led and 7 segment with 8951 pooja jaiswal
 
Ppt on interfacing led and 7 segmentwith 8951
Ppt on interfacing led  and 7 segmentwith 8951Ppt on interfacing led  and 7 segmentwith 8951
Ppt on interfacing led and 7 segmentwith 8951pooja jaiswal
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
"BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER""BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER"FAIZAN SHAFI
 
Basic arduino sketch example
Basic arduino sketch exampleBasic arduino sketch example
Basic arduino sketch examplemraziff2009
 
Arduino ohm meter by Engr.Danish Nouman
Arduino ohm meter  by Engr.Danish NoumanArduino ohm meter  by Engr.Danish Nouman
Arduino ohm meter by Engr.Danish Nouman4319961511995
 
7-Segment Display
7-Segment Display7-Segment Display
7-Segment DisplayMay Ann Mas
 
Electronz_Chapter_4.pptx
Electronz_Chapter_4.pptxElectronz_Chapter_4.pptx
Electronz_Chapter_4.pptxMokete5
 
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 MicrocontrollerIRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET - Interfacing Multi-Digit 7-Segment with 8051 MicrocontrollerIRJET Journal
 
Seven segment interfacing with 8051.pdf
Seven segment interfacing with 8051.pdfSeven segment interfacing with 8051.pdf
Seven segment interfacing with 8051.pdfSrikrishna Thota
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptxHebaEng
 
Digital clock presentation
Digital clock presentationDigital clock presentation
Digital clock presentationAditya Jha ✅
 
Electronz_Chapter_12.pptx
Electronz_Chapter_12.pptxElectronz_Chapter_12.pptx
Electronz_Chapter_12.pptxMokete5
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock deviceAmitoj Kaur
 

Semelhante a Est 6 (20)

Ppt on interfacing led and 7 segment with 8951
Ppt on interfacing led and 7 segment with 8951 Ppt on interfacing led and 7 segment with 8951
Ppt on interfacing led and 7 segment with 8951
 
Ppt on interfacing led and 7 segmentwith 8951
Ppt on interfacing led  and 7 segmentwith 8951Ppt on interfacing led  and 7 segmentwith 8951
Ppt on interfacing led and 7 segmentwith 8951
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
7segmentdisplay
7segmentdisplay7segmentdisplay
7segmentdisplay
 
"BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER""BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER"
 
Basic arduino sketch example
Basic arduino sketch exampleBasic arduino sketch example
Basic arduino sketch example
 
Anup2
Anup2Anup2
Anup2
 
Arduino ohm meter by Engr.Danish Nouman
Arduino ohm meter  by Engr.Danish NoumanArduino ohm meter  by Engr.Danish Nouman
Arduino ohm meter by Engr.Danish Nouman
 
LCD WITH 8051.docx
LCD WITH 8051.docxLCD WITH 8051.docx
LCD WITH 8051.docx
 
7-Segment Display
7-Segment Display7-Segment Display
7-Segment Display
 
Electronz_Chapter_4.pptx
Electronz_Chapter_4.pptxElectronz_Chapter_4.pptx
Electronz_Chapter_4.pptx
 
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 MicrocontrollerIRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
 
Seven segment interfacing with 8051.pdf
Seven segment interfacing with 8051.pdfSeven segment interfacing with 8051.pdf
Seven segment interfacing with 8051.pdf
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Digital clock presentation
Digital clock presentationDigital clock presentation
Digital clock presentation
 
Electronz_Chapter_12.pptx
Electronz_Chapter_12.pptxElectronz_Chapter_12.pptx
Electronz_Chapter_12.pptx
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock device
 

Mais de Akshay Sharma

Eye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaEye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaAkshay Sharma
 
The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...Akshay Sharma
 
Over voltage protector circuit
Over voltage protector circuitOver voltage protector circuit
Over voltage protector circuitAkshay Sharma
 
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Akshay Sharma
 
A_law_and_Microlaw_companding
A_law_and_Microlaw_compandingA_law_and_Microlaw_companding
A_law_and_Microlaw_compandingAkshay Sharma
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robotAkshay Sharma
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 

Mais de Akshay Sharma (14)

Eye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaEye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegia
 
The buzzer glove
The buzzer gloveThe buzzer glove
The buzzer glove
 
The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...
 
Over voltage protector circuit
Over voltage protector circuitOver voltage protector circuit
Over voltage protector circuit
 
Haptic technology
Haptic technologyHaptic technology
Haptic technology
 
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
 
A_law_and_Microlaw_companding
A_law_and_Microlaw_compandingA_law_and_Microlaw_companding
A_law_and_Microlaw_companding
 
8085 instructions
8085 instructions8085 instructions
8085 instructions
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robot
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Est 11
Est 11Est 11
Est 11
 
Est 8 2 nd
Est 8 2 ndEst 8 2 nd
Est 8 2 nd
 
Est 8 1 st
Est 8 1 stEst 8 1 st
Est 8 1 st
 
Est 1
Est 1Est 1
Est 1
 

Último

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 

Último (20)

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

Est 6