fbpx

Interface Seven Segment with 8051

A seven segment display is use to display digits from 0-9.Seven segment display widely used in digital clocks,weight machine, Ph meters etc.

The common configuration has an array of eight leds arranged to display these digits.Leds are assigned with alphabets from a to h and its identified by those alphabets. Seven leds a to g are used to display the numerals while eighth led h is used to display the dot/decimal.

Direction Table

Hardware Required

  • 7 Segment Display
  • 220 ohms resistor
  • 8051 microcontroller

Circuit

Virtual Circuit

Code

#include <REGx51.h>
 void delay()
 {
   int i,j;
   for(i=0;i<1000;i++)
   {
    for(j=0;j<100;j++);
   }
 }
 void main()
 {
  P1=0x3f;   // To Display No.0
  delay();
  P1=0x06;   // To Display No.1
  delay();
  P1=0x5b;   // To Display No.2
  delay();
  P1=0x4f;   // To Display No.3
  delay();
  P1=0x66;   // To Display No.4
  delay();
  P1=0x6d;   // To Display No.5
  delay();
  P1=0x7d;   // To Display No.6
  delay();
  P1=0x07;   // To Display No.7
  delay();
  P1=0x7f;   // To Display No.8
  delay();
  P1=0x67;   // To Display No.9
  delay();
 }

Leave a Reply

Your email address will not be published. Required fields are marked *