Homework 2: Anshul Gour September 2, 2019
Homework 2: Anshul Gour September 2, 2019
Anshul Gour
September 2, 2019
Q-2. Sketch the pin diagram of common cathode and common anode seven segment
LED with the brief explanation of working principle.
1
Working Principle:- When the power is given to all the segments, then the number 8 will be
displayed. If you disconnect the power for segment G (that means 7) then that will result number 0.
The circuit of the seven segment display is designed in such a way that the voltage at different pins can
be applied at the same time. In the same way, you can form the combinations to display numerals from
0 to 9.
Practically, seven segment displays are available with two structures, both the type of displays consists
of 10 pins.
Ans:
#include<r e g 5 2 . h>
void main ( )
{
P1=0x00 ;
while ( 1 )
{
P1=0x07 ;
msdelay ( 1 0 0 ) ;
}
}
Q-4. Write a c program to display alphanumeric characters on common anode seven
segment led.[0-9,A-F]
Ans:
#include<r e g 5 2 . h> //To show number 7 u s i n g common anode SSD
2
int i , j ;
for ( i =0; i<=d e l a y ; i ++)
for ( j =0; j <=500; j ++)
{};
}
void main ( )
{
P1=0x11 ; //LEDs O f f Initially
while ( 1 ) // I n f i n i t e Loop
{
P1=0xF8 ; // To show Number 7
msdelay ( 1 0 0 ) ; // C a l l msdelay F u c t i o n
}
}
Q-5. Write a c program to display sequential alphanumeric characters on common
cathode seven segment led.[0-9,A-F]
Ans:
#include<r e g 5 2 . h>
int a [ 1 6 ] = {0xBF , 0 x06 , 0 x5B , 0 x4F , 0 x66 , 0 x6D , 0 x7D , 0 x07 , 0 x7F , 0 x6F , 0 x77 , 0 x7F , 0 x39 , 0 xB
void main ( )
{
P1=0x00 ;
while ( 1 )
{
int i ;
for ( i =0; i <16; i ++)
{
P1= a [ i ] ;
msdelay ( 1 0 0 ) ;
}
}
}
Q.6. Make table for common cathode seven segment LED for alphanumeric. .[0-9,A-F]
3
Character A B C D E F G
0 1 1 1 1 1 1 0
1 0 1 1 0 0 0 0
2 1 1 0 1 1 0 1
3 1 1 1 1 0 0 1
4 0 1 1 0 0 1 1
5 1 0 1 1 0 1 1
6 1 0 1 1 1 1 1
7 1 1 1 0 0 0 0
8 1 1 1 1 1 1 1
9 1 1 1 1 0 1 1
A 1 1 1 0 1 1 1
b 0 0 1 1 1 1 1
C 1 0 0 1 1 1 0
d 0 1 1 1 1 0 1
E 1 0 0 1 1 1 1
F 1 0 0 0 1 1 1