0% found this document useful (0 votes)
7 views2 pages

Seven Segment Display Control Code

Jskskskdndbdbdjdjjdnssjnsnsjdjdjdjjdjdjdjsjsdjdjjdjdjdjs

Uploaded by

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

Seven Segment Display Control Code

Jskskskdndbdbdjdjjdnssjnsnsjdjdjdjjdjdjdjsjsdjdjjdjdjdjs

Uploaded by

anamayank111
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3&8 -ve

H G F E D C B A Data Digits
0 0 1 1 1 1 1 1 0x3F 0
0 0 0 0 0 `1 1 0 0x06 1
0 1 0 1 1 0 0 1 0x5B 2
0 1 0 0 1 1 1 1 0x4F 3
0 1 1 0 0 1 1 0 0X66 4
0 1 1 0 1 1 0 1 0x6D 5
0 1 1 1 1 1 0 1 0x7D 6
0 0 0 0 0 1 1 1 0X07 7
0 1 1 1 1 1 1 1 0x7F 8
0 1 1 0 1 1 1 1 0x6F 9
Exp No. 5 Date: D D - M M - Y Y

INTERFACING SEVEN SEGMENT DISPLAY


AIM
To display ‘0-9-0’ continuously on seven segment common cathode display with segments
connected to PA0 to PA7 with a suitable delay in between.

Program
#define F_CPU 1600000UL //clock frequency
#include <avr/io.h> // standard AVR header
#include <util/delay.h> // delay loop function

int main(void)
{
DDRA = 0xff; // setting PORTA as output
while (1) // indefinite loop
{
PORTA = 0x3f; // setting value for PORTA for 0
_delay_ms(1000); //delay
PORTA = 0x06; // setting value for PORTA for 1
_delay_ms(1000); //delay
PORTA = 0x5B; // setting value for PORTA for 2
_delay_ms(1000); //delay
PORTA = 0x4F; // setting value for PORTA for 3
_delay_ms(1000); //delay
PORTA = 0x66; // setting value for PORTA for 4
_delay_ms(1000); //delay
PORTA = 0x6D; // setting value for PORTA for 5
_delay_ms(1000); //delay
PORTA = 0x7D; // setting value for PORTA for 6
_delay_ms(1000); //delay
PORTA = 0x07; // setting value for PORTA for 7
_delay_ms(1000); //delay
PORTA = 0x7F; // setting value for PORTA for 8
_delay_ms(1000); //delay
PORTA = 0x6F; // setting value for PORTA for 9
_delay_ms(1000); //delay
}
}

Result

Embedded C program for 7 segment display is written with delay routine, compiled the program,
downloaded in target board, and implemented.

You might also like