Real Time Clock Circuit using Mircocontroller PIC16F84A

Here I am going to teach you a simple circuit of 24 hour digital clock display that can also be used in 12 hour format by simply loading the corresponding clock program. You can download the hex files for both 12 hour format and 24 hour time system from the link given in this article. Coming to the technical part, main component of the circuit is a PIC16F84A microchip; it generates the one second clock to run the device and also controls the seven segment display. Three push buttons are also provided to set the time; one for reset by which you can reset the complete circuit as it is connected to the reset pin of PIC microcontroller. Other two push buttons are for setting hour and minute. By Pressing these button continuously you can increment hour and minutes.

The main feature of this real time clock circuit is that it only draws less than 100mA, so it can be run with rechargeable batteries. By increasing the value of resistors connected to the seven segment display you can decrease the current gain. 24(international time clock) to 12 hour time clock conversion can be done simply by burning the PIC microchip with the corresponding hex file.

Download Hex file of real time embedded C

The hex file for both 12 hour and 24 hour time clock are available at our Download Center.
(In case you are facing any problem in downloading the files, use the comment box at the bottom
Download link Updated: 14/June/2013)

Circuit diagram of Pacific Time clock

Click on the circuit for enlarged view

Components Required

  1. PIC 16F84A
  2. Transistor BC548 (4-Nos)
  3. Resistor (180R-9Nos,10K,1K-4Nos)
  4. LED
  5. Capacitor(22pf2Nos)
  6. Push button (3-Nos)
  7. Crystal 4MHz
  8. Common cathode seven segment display (4-Nos)

How to make a digital clock?

  • We use four common cathode seven segment displays which are connected in PORTB of the PIC.
  • The seven inputs of seven segment displays are connected in parallel but it shows different values it is done by continues scanning, that is if a value want display on the first seven segment display activate the corresponding transistor then send the value to through the port that is shown below.
  • To display a value on the second display activate the second transistor and send value through PORTB.
  • This scanning is continually done by PORTA and PORTB sends the display value.
  • Three push buttons are used one for reset the microcontroller and remaining two for set minute and hour which connected in PORTB which scan to get a zero volt on the pins RB6and RB7.
  • An LED connected on the RB0 which blink for on second

Components pin out

7 segment display

49 thoughts on “Real Time Clock Circuit using Mircocontroller PIC16F84A

  1. in the 'components required' column you have mentioned the display as "Common anode seven segment displays" but in the 'how to make digital clock' column you have mentioned it as "common cathode seven segment displays"..please tell me that whether it is anode or cathode display?

  2. sir,u have used dot board for connecting all these components together but it is tough job to connect it at the back side of dot board. can u tell me the PCB board type for this circuit?

  3. Assala-mu-alaikum sir,
    I want to know, Is this microcontroller has already programmed or it’s need to programme by me? please sir reply. I’m from Bangladesh and visit your site regularly.
    Thanks in advance.

  4. program is not working …its not letting me to set the time…as soon as u turn on the power it will start increasing min digits (2digits/sec)

  5. AOA, Sir!
    Kindly tell me what is the origional size of HEX file of 24 hour clock, because after downloading i got a 2kb file, is it OK?

  6. I am getting zero in all display when run on proteus software. The HEX file is loaded correctly in the edit mode of 16F84A.


  7. I couldn’t find download link to download hex file of Real Time Clock Circuit using Mircocontroller PIC16F84A.

  8. Hi Admin
    there is a problem in this clock design ,it is reset when we use the 5 volt power supply converted from AC 220 v .when ever some FAN or light Switch on ,The Time is Reset to 00.00 . kindly suggest me to what to do if we want to use it with Ac power .
    Thanks in Advance
    Jaspreet Singh

  9. AsalaamOAliakum
    I am getting zero in all display when run on proteus software. The HEX file is loaded correctly in the edit mode of 16F84A. what is a problem Plz ask me.

  10. Hi sir,
    I made it but whn i start the clock,hour display is incrising by itself…also which led are not glow as per programming those are quite deam but not fully off…what is the actual reason.please help me.

  11. I happen to not have four 7 segment displays for this. I do however have one that’s on bar with the same amount of display. How can I use this to work with this project? I’m very new to this and taking a physics and engineering class in highschool right now. I am going into an engineering major next year so I want to do something like this.

  12. Hello! I’m doing this for my physics and engineering class. I was wondering if you had a PCB for this? I’m working on it, but want something to compare to and I don’t have a lot of tie to finish this project. Thanks!

Leave a Reply

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