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
Project Components
Project Video
Filed Under: 8051 Microcontroller
Filed Under: 8051 Microcontroller
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.