Aim:
The main aim of this project is how to interface 7-segment and display 0 to 99 values on 7-segments.
The main aim of this project is how to interface 7-segment and display 0 to 99 values on 7-segments.
Description:
Introduction
Till now you have learn what is an embedded system, basic memory
architecture of a microcontroller, how to implement assembly language
and use of some softwares like pinnacle 52, keil-C and flash magic; we
also have come across how to interface LEDs from a microcontroller and
how to generate different pattern through it. now its time to move
forward and learn one more step ahead towards the completion of our
6-weak training. so here today we will learn about 7-Segment display;
How to interface and program it; and some of the applications of it.
7-Segment Display
A 7-Segment display is a useful electronic component use to
produce numeric, alphabetic and some non-alphabetic symbols using a
specific arrangement of LEDs as shown in figure here.
A 7-Segment display has 10-Pins representing each a, b, c, b, e, f, gand h LEDs respectively along with two extra pins for GND andVSS. following shown an original 7-Segment display device along with its pin diagram. LED h is also denoted by symbol dp.
As we have studied in LED interfacing a 7-segment display is also
interfaced in same way as it is also made of LEDs. So we can interface
LEDs in three ways bu here difference is that 7-Segment displays comes
in two types by manufacturers i.e. “Common Anode” and “Common Cathode“; the logics are shown in figure below.
and thus which logic is o implement is on the bases of these specifications provided by manufacturer.
Digit Drive Pattern:
To display the digits on 7 segment, we need to glow different logic
combinations of segments. For example if you want to display the digit 3
on seven segment then you need to glow the segments a, b, c, d and g.
The below table show you the Hex decimal values what we need to send
from PORTB to Display the digits from 0 to 9.
DIGIT DP G F E D C B A HEX VALUE
0 0 0 1 1 1 1 1 1 0x3f
1 0 0 0 0 0 1 1 0 0x06
2 0 1 0 1 1 0 1 1 0x5b
3 0 1 0 0 1 1 1 1 0x4f
4 0 1 1 0 0 1 1 0 0x66
5 0 1 1 0 1 1 0 1 0x6d
6 0 1 1 1 1 1 0 1 0x7d
7 0 0 0 0 0 1 1 1 0x07
8 0 1 1 1 1 1 1 1 0x7f
9 0 1 1 0 0 1 1 1 0x67
Introduction
Till now you have learn what is an embedded system, basic memory
architecture of a microcontroller, how to implement assembly language
and use of some softwares like pinnacle 52, keil-C and flash magic; we
also have come across how to interface LEDs from a microcontroller and
how to generate different pattern through it. now its time to move
forward and learn one more step ahead towards the completion of our
6-weak training. so here today we will learn about 7-Segment display;
How to interface and program it; and some of the applications of it.
7-Segment Display
A 7-Segment display is a useful electronic component use to
produce numeric, alphabetic and some non-alphabetic symbols using a
specific arrangement of LEDs as shown in figure here.
A 7-Segment display has 10-Pins representing each a, b, c, b, e, f, gand h LEDs respectively along with two extra pins for GND andVSS. following shown an original 7-Segment display device along with its pin diagram. LED h is also denoted by symbol dp.
As we have studied in LED interfacing a 7-segment display is also
interfaced in same way as it is also made of LEDs. So we can interface
LEDs in three ways bu here difference is that 7-Segment displays comes
in two types by manufacturers i.e. “Common Anode” and “Common Cathode“; the logics are shown in figure below.
and thus which logic is o implement is on the bases of these specifications provided by manufacturer.
Digit Drive Pattern:
To display the digits on 7 segment, we need to glow different logic
combinations of segments. For example if you want to display the digit 3
on seven segment then you need to glow the segments a, b, c, d and g.
The below table show you the Hex decimal values what we need to send
from PORTB to Display the digits from 0 to 9.
DIGIT | DP | G | F | E | D | C | B | A | HEX VALUE |
0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0x3f |
1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0x06 |
2 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0x5b |
3 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0x4f |
4 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0x66 |
5 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0x6d |
6 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0x7d |
7 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0x07 |
8 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0x7f |
9 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0x67 |
Block Diagram
Schematic
Code
// ******************************************************
// Project: 0 to 99 display in 7-segments using 8051
// Author: Code Bloges
// Module description: Operate two 7-segments
// ******************************************************
#include<reg51.h>
void delay(int i)
{
for(;i>0;i--);
}
int main(void)
{
int k,l,a[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67};
while(1)
{
for(k=0;k<10;k++)
{
for(l=0;l<10;l++)
{
P3=0x01;
P2=a[l];
delay(5000);
P3=0x02;
P2=a[k];
delay(5000);
}
delay(5000);
}
}
}
// ****************************************************** // Project: 0 to 99 display in 7-segments using 8051 // Author: Code Bloges // Module description: Operate two 7-segments // ****************************************************** #include<reg51.h> void delay(int i) { for(;i>0;i--); } int main(void) { int k,l,a[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67}; while(1) { for(k=0;k<10;k++) { for(l=0;l<10;l++) { P3=0x01; P2=a[l]; delay(5000); P3=0x02; P2=a[k]; delay(5000); } delay(5000); } } }
Downloads:
The code was compiled in Keil uvision4 and simulation was made in Proteus v7.7.
To download code and proteus simulation click here.
To download code and proteus simulation click here.
No comments:
Post a Comment