Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe

User input based seven segment display using 8051 microcontroller (AT89C51)- (Part 3/45)

By Himanshu Choudhary August 2, 2010

This article is a simple application built around the seven segment display. The circuit has ten inputs corresponding to digits zero to nine. Whenever an input is pressed the corresponding digit is displayed on the seven segment.The microcontroller used is AT89C51 which belongs to the 8051 series of microcontroller.

 


 

 

The circuit can be divided into two units: the controller unit and the display unit. The controller unit consists of a microcontroller circuit. The microcontroller used here is AT89C51 . The display unit consists of a seven segment circuit which is interfaced to the microcontroller. The circuit is similar to the seven segment circuit

 

with the only difference that here we have ten input pins. Each input pin corresponds to one of the digits to be displayed on the seven segment. Here the pin 0 to pin 7 of port P3, pin 6 and pin 7 of port P 1 are made the input pins. The output is sent to the seven segment through Port 2 of the microcontroller.

 

 

 

Project Source Code

###

// Program to display number by taking input from the user

#include <reg51.h>

sbit in1=P1^0;        //input pins
sbit in2=P1^1;
sbit in3=P1^2;
sbit in4=P1^3;
sbit in5=P1^4;
sbit in6=P1^5;
sbit in7=P1^6;
sbit in8=P3^1;
sbit in9=P3^2;
sbit ina=P3^3;

sbit ou1=P2^0;        // output pins
sbit ou2=P2^1;
sbit ou3=P2^2;
sbit ou4=P2^3;
sbit ou5=P2^4;
sbit ou6=P2^5;
sbit ou7=P2^6;

void main()
{
    in1 = in2 = in3 = in4 = in5 = in6 = in7 = in8 = in9 = ina = 1;        // Initialize the input pin
    ou1 = ou2 = ou3 = ou4 = ou5 = ou6 = ou7 = 1;
    while(1)
    {
        while (in1==0)
        {
        ou2 = ou3 = 0;
        ou1 = ou4 = ou5 = ou6 = ou7 = 1;
        }

        while (in2==0)
        {
        ou1 = ou2 = ou4 = ou5 = ou7 = 0;
        ou3 = ou6 = 1;
        }
        
        while (in3==0)
        {
        ou1 = ou2 = ou4 = ou3 = ou7 = 0;
        ou5 = ou6 = 1;
        }

        while (in4==0)
        {
        ou3 = ou2 = ou6 = ou7 = 0;
        ou1 = ou4 = ou5 = 1;
        }

        while (in5==0)
        {
        ou1 = ou3 = ou4 = ou6 = ou7 = 0;
        ou2 = ou5 = 1;
        }

        while (in6==0)
        {
        ou1 = ou5 = ou3 = ou4 = ou6 = ou7 = 0;
        ou2 = 1;
        }

        while (in7==0)
        {
        ou1 = ou3 = ou2 = 0;
        ou4 = ou5 = ou6 = ou7 = 1;
        }

        while (in8==0)
        {
        ou1 = ou2 = ou5 = ou3 = ou4 = ou6 = ou7 = 0;
        }

        while (in9==0)
        {
        ou1 = ou2 = ou3 = ou4 = ou6 = ou7 = 0;
        ou5 = 1;
        }

        while (ina==0)
        {
        ou1 = ou3 = ou4 = ou6 = ou2 = ou5 = 0;
        ou7 = 1;
        }
    }
}

###

 


Circuit Diagrams

Circuit-Diagram-of-User-input-based-seven-segment-display-using-8051-microcontroller-AT89C51

Project Components

  • AT89C51 Microcontroller
  • LED
  • Seven Segment Display

Project Video


Filed Under: 8051 Microcontroller
Tagged With: 8051, display, microcontroller, seven segment
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Power Efficiency
Discover proven strategies for power conversion, wide bandgap devices, and motor control — balancing performance, cost, and sustainability across industrial, automotive, and IoT systems.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions.

  • MC145151/2 p2 calculation dip swich vs xtal divader
  • Looking for Detector Switches similar to PANASONIC ESE24CMH with a 12V rating
  • Crude Powerline FSK comms literally shorts the power bus at a certain frequency?
  • Direction and Orientation of Current in Transformer
  • Is a Digitizer Necessary for INL and DNL Measurement in DACs?

RSS Electro-Tech-Online.com Discussions

  • need help in photodetection TIA circuit
  • Need to solder a really delicate ribbon for an electric reel need advice
  • Need Help Troubleshooting a PCB Assembly Issue
  • Solar tracker simulation
  • Help please! BLDC driver circuit using the IR2136s and the STP80NF06 MOSFETS

Featured Tutorials

Real Time Hardware Filter Design

  • Practical implementation of bandpass and band reject filters
    Practical implementation of bandpass and band reject filters
  • Practical application of hardware filters with real-life examples
    Practical application of hardware filters with real-life examples
  • A filter design example
    A filter design example
  • Types of filter responses
    Types of filter responses
  • What are the two types of hardware filters?
    What are the two types of hardware filters?
  • What are hardware filters and their types?
    What are hardware filters and their types?
More Tutorials >

Recent Articles

  • Microchip extends single pair Ethernet lineup with software-less endpoint
  • Infineon MCU targets high-voltage BMS in electric vehicles
  • SemiQ releases expanded SiC MOSFET lineup with detailed thermal and switching data
  • TDK adds 1000 W models to dc-dc converter series
  • LEMO introduces resin-free IP68 connectors for compact equipment

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe