7-Segment Display Interfacing with AVR ATmega16

Introduction

A seven segment display is a set of seven bar-shaped LED (light-emitting diode) elements, arranged to form a squared-off figure 8. It’s also the most common, simple-to-use and cheap display.

Applications

Seven segment are widely used in applications where digits[0-9] are required to be displayed.Although they also display letters A to F as shown in figure(2) simulation. This is a very simple and convenient way to display numbers in a bright fashion.

Form Factor

  • Sizes:They come in various sizes; 0.28”, 0.3”, 0.32”, 0.36”, 0.39”, 0.4”, 0.5”, 0.56”, 0.6”, 0.8”, 1.0”, 1.2”, 1.5”, 1.8”, 2.0”, 2.3”, 3.0”, 4.0”, 5.0”, 7.0”)
  • Colors: and varied colors too; Red, Green, Yellow, Orange, Blue, and White.

Working

Since these are basically LEDs arranged as a group they can either have anode in common or cathode thus they are named as Common-Anode/Common-Cathode displays.

The Seven-segment consists of 7 LEDs arranged in a way that allows constructing a display of the numbers of (0-9). It has 10 pins assigned as follows:

  • Common Cathode: In this type of segments all the cathode terminals are made common and tied to GND. Thus the segments a to g needs a logic High signal(5v) in order to glow.This is shown in figure.

  • Common Anode: In this type of segments all the anodes terminals are made common and tied to VCC(5v). Thus the segments a to g needs a logic LOW signal(GND) in order to glow.This is shown in figure.

Circuit diagram

Program 

/*
 Author-Dharmendra Kumar yadav
 
*/ 
#include <avr/io.h>
#include <util/delay.h>
#define LED_Direction DDRA		/* define LED Direction */
#define LED_PORT PORTA			/* define LED port */

int main(void)
{
	LED_Direction |= 0xff;		/* define LED port direction is output */
	LED_PORT = 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++)
		{
			LED_PORT = array[i]; /* write data on to the LED port */
			_delay_ms(1000); /* wait for 1 second */ 
		}
    }
}

Leave a comment

Blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started