Tuesday, January 24, 2012

Simple Digital clock using 8051 microcontroller (AT89C51)

Posted by Unknown at 9:34 PM 0 Comments
A digital clock is one that displays time digitally. The circuit explained here displays time with two ‘minutes’ digits and two ‘seconds’ digits on four seven segment displays. The seven segment and switches are interfaced with 8051 microcontroller AT89C51. This circuit can be used in cars, houses, offices etc.

 As soon as the Vcc supply is provided to this circuit, the clock starts from 00:00. The time is displayed on four seven segments (in common anode configuration) by using the concept of multiplexing. This is achieved by using timer interrupt (Timer0) of AT89C51

which is configured to refresh seven segments. The segments are refreshed many times in a second for simultaneous display. The clock runs with a delay of exactly one second. Timer1 has been used to produce a time delay of one second. The data pins (a–h) of all the segments are interconnected and receive signal from port P2 of the microcontroller. The control or enable pins (common anode) are connected to pins 1-4 of port P1 (P1^0 – P1^3).
The number on 4th segment (displaying the unit digit of second) is incremented once in a second as it goes from 0 to 9. The number on 3rd segment is incremented after every 10 seconds from 0 to 5. Thus seconds are displayed varying from 00 to 59. The digit on the 2nd segment changes after every 60 seconds (a minute) from 0 to 9 and so on. Thus the clock runs for an hour and after that it resets to zero again



// Program to demonstrate the principle of digital clock. this digital clock displays two minute digits and two second digits

sbit dig_ctrl_4=P1^0;        //Declaring control pins of the seven segments
sbit dig_ctrl_3=P1^1;
sbit dig_ctrl_2=P1^2;
sbit dig_ctrl_1=P1^3;
unsigned char dig_disp=0;
int min2;
int min1;
int sec2;
int sec1;
char digi_val[10]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10};

void delay()        //Function to provide a time delay of approx. 1 second. using Timer 1.
    int i;

void display() interrupt 1        //Function to display the number using seven segmnet multiplexing. For more details refer seven segment multiplexing.
    TL0=0x36;        //Reloading Timer0
    dig_ctrl_1 = dig_ctrl_3 = dig_ctrl_2 = dig_ctrl_4 = 0;
        case 0:
        dig_ctrl_1 = 1;
        case 1:
        P2=    digi_val[sec2];
        dig_ctrl_2 = 1;
        case 2:
        P2=    digi_val[min1];
        dig_ctrl_3 = 1;
        case 3:
        P2=    digi_val[min2];
        dig_ctrl_4 = 1;

void main()
    TMOD=0x11;        //Intialize Timer 0
    IE=0x82;        // Enable Timer 0 interrupt
    TR0=1;        //Start Timer 0
    while(1)        //Start clock

Transistor BC547 
AT89C51 Microcontroller 
Seven Segment Display 

Share This Post

Get Updates

Subscribe to our Mailing List. We'll never share your Email address.





AERONAUTICAL AEROSPACE AGRICULTURE ANDROID Android project titles Animation projects Artificial Intelligence AUTOMOBILE BANK JOBS BANK RECRUITMENTS BIG DATA PROJECT TITLES Bio instrumentation Project titles BIO signal Project titles BIO-TECHNOLOGY BIOINFORMATICS BIOMEDICAL Biometrics projects CAREER CAT 2014 Questions CHEMICAL CIVIL Civil projects cloud computing COMP- PROJ-DOWN COMPUTER SCIENCE PROJECT DOWNLOADS COMPUTER(CSE) CONFERENCE Data mining Projects Data protection. Design projects DIGITAL SIGNAL PROCESSING IEEE Project titles Dot net projects EBOOKS ELECTRICAL MINI PROJECTS ELECTRICAL PROJECTS DOWNLOADS ELECTRONICS MINI PROJECTS ELECTRONICS PROJECT DOWNLOADS EMG PROJECTS employment Engineering projects Exams Facts final year projects FOOD TECHNOLOGY FREE IEEE 2014 project Free IEEE Paper FREE IEEE PROJECTS GATE GAte scorecard GOVT JOBS Green projects GSM BASED Guest authors HIGHWAY IEEE 2014 projects ieee 2015 projects IEEE computer science projects IEEE Paper IEEE PAPER 2015 ieee project titles IEEE projects IEEE Transactions INDUSTRIAL INNOVATIVE PROJECTS INTERFACING IT IT LIST Java projects labview projects LATEST TECHNOLOGY list of project centers Low cost projects m.com MARINE Matlab codes MATLAB PROJECT TITLES MATLAB PROJECTS MBA MBA 2015 projects MCA MECHANICAL MECHANICAL PROJECTS DOWNLOAD MINI PROJECTS modelling projects MP3 MP3 cutter Mp4 Networking topics ns2 projects online jobs PETROCHEMICAL PHYSIOLOGICAL MODELLING projects physiotheraphy Projects Power electronics power system projects PRODUCTION project centers project downloads Prosthesis projects RAILWAY RECRUITMENT 2012 Recent RECENT TECHNOLOGY RECENT TECHNOLOGY LIST RECRUITMENT Rehabilitation projects renewable power respiration projects RESUME FORMAT. Ring Tone Cutter Robotics projects. Robots in medical social network jobs Solar projects Songs Cutter Speech-music separation-Abstract structural engineering TECHNOLOGY technology management TELE COMMUNICATION TEXTILE TOP ENGINEERING COLLEGES Training VLSI


This blogs is an effort to club the scattered information about engineering and project titles and ideas available in the web. While every effort is made to ensure the accuracy of the information on this site, no liability is accepted for any consequences of using it. Most of the material and information are taken from other blogs and site with the help of search engines. If any posts here are hitting the copyrights of any publishers, kindly mail the details to educations360@gmail.com It will be removed immediately.

Alexa Rank

back to top