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

7-Segment Display Interfacing With Avr Atmega16

This document discusses interfacing a 7-segment LED display with an AVR ATmega16 microcontroller. It describes how a 7-segment display uses 8 LED segments - 7 line segments and 1 decimal point segment - to display numbers and some letters. It also explains the common anode and common cathode types of 7-segment displays and how the control signals differ between them. The code sample shows how to define the 7-segment port as an output, initialize it to display all segments, and then loop through an array of hex values to display the numbers 0-9 on the display, each for 1 second.

Uploaded by

Gaurav Shinde
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)
99 views

7-Segment Display Interfacing With Avr Atmega16

This document discusses interfacing a 7-segment LED display with an AVR ATmega16 microcontroller. It describes how a 7-segment display uses 8 LED segments - 7 line segments and 1 decimal point segment - to display numbers and some letters. It also explains the common anode and common cathode types of 7-segment displays and how the control signals differ between them. The code sample shows how to define the 7-segment port as an output, initialize it to display all segments, and then loop through an array of hex values to display the numbers 0-9 on the display, each for 1 second.

Uploaded by

Gaurav Shinde
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
You are on page 1/ 2

7-Segment Display Interfacing with AVR ATmega16

7-Segment LED Display

7-segment displays are made up of 8 LED segments. 7 of these LED segments are in the shape of
a line, whereas 1 segment is circular.

The 7 line-shaped LED segments are used for displaying numbers 0 to 9 and a few letters like A,
c, d, e, F, H, L, O, P, U, etc. The circular segment is used for displaying a decimal point.

Each of the 8 elements has a pin associated with it which can be driven HIGH or LOW according
to the type of display and the number or alphabet to be displayed.

The common anode and common cathode types are available in a 7-segment display. Depending
on which type is used, the control signal required to light up a segment in the display changes.
Common anode requires a LOW signal whereas common cathode requires a HIGH signal to light
up a segment.

. Interfacing 7-Segment LED Display With AVR ATmega16


Program
#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{

DDRA= 0xff; /* define 7 segment port direction is output */


PORTA = 0xff;

char array[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
/* write hex value for CA display from 0 to 9 */

while(1)
{

for(int i=0;i<10;i++)
{

PORTA = array[i]; /* Send data to the 7 segment display */


_delay_ms(1000); /* wait for 1 second */
}
}
}

You might also like