PIC 16F84 12 24 Hour Digital Clock Circuit And Programming

PIC 16F84 12 24 Hour Clock

PIC16F84 12 or 24 Hour Digital Clock Circuit Diagram And Programming

This PIC digital clock is based on a 16F84 microcontroller. it uses four 7-segment displays.The software in the microcontroller allows for very accurate timekeeping.

PIC 16F84 pic16f84a 12 24 Hour Clock Circuit diagram

R1 – R8 100Ω
R9 10kΩ
R10 R13 10kΩ
C1 22pF
C2 22pF
U1 – U4 Common Cathode 7 Segment Display
Q1 – Q4 C828
Xtal1 4 MHz Crystal
IC1 7805 Regulator IC
PB1 -PB3 Push to ON push button switch

PB1 for set minutes.

PB2 for set hours.

PB3 for Reset.

D1 LED indicate seconds.


Thats all. :-)

pic16f84 pic16f84a microcontroller pin configuration

PIC16F84 Pin Configuration

Also provided asm files, so you can develop or modify this clock circuit.

Download digital clock asm and hex files.

PIC 16F84 12 24 Hour Clock PIC 16F84 PIC16F84A 12 24 Hour DIGITAL Clock

Please send your ideas, which are very important for our success…

Tags: , ,
88 comments on “PIC 16F84 12 24 Hour Digital Clock Circuit And Programming
  1. ultrasound technician says:

    This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post. Thanks!

  2. Great site. A lot of useful information here. I’m sending it to some friends!

  3. SOLOMON ADAH says:

    nice work, i needed just that for my project.

  4. bmx wheels says:

    nice, thank you so much 😉

  5. ryan says:

    can you add a pcb for this?? i cant create one, it took me 3hrs but still failed..

  6. Kilroy says:

    can u send me the pcb file plx

  7. Sofa King says:

    Does somebody know how to reprogram the .asm file?

    This is what I want to happen:

    If clock strikes 6:00 am, 11:00 am, 16:00 pm, there will be an output that will be triggered.

    We are planning to use the circuit for a feeder project. Please help. Thank you.

  8. srihari says:

    i have constructed this working good with battery but not with home supply, when i switched on and off the appliances in the same room the device is (time) reset whats the problem give me solution
    thank you….

  9. pido says:

    c828 is npn or pnp transistor?

  10. sara says:

    Thanks for this info! However, it might be a tip to put more comments in the code so the inexperienced user knows what’s going on – for instance which part of the code controls the actual clock? What do the ten or so short lines directly under the header do?

  11. luqman yousaf says:

    nice work i made it

  12. Dessy says:

    hey I have a problem on how to program a 16f84 with assembly language to drive a 16-segment LED which would spell out a word. just one display which shows a letter at a time.

    Please can you help?

    thank you

  13. Alberto Vazquez says:

    Hi buddy, can you put an ASM or HEX CODE for an clokc of 4.8MHz I have an sueper stable master oscilator for 4.8MHz and I want to use this temp controlled osc. to manage this clock projet.

    Tahnks you in advance.


  14. Avik says:

    can anyone tell me how to change between 24hrs and 12hrs? do i need to change the program?

  15. Avik says:

    can anyone convert this hex codes for 16f628a?

  16. arun says:

    i have a problem with this
    first i has constructed this circuit power is given by 6v stepdown transformer with 5v voltage regulator. when i switched on the fan or tube light the clock is reset what is the problem please suggest me thank you.

  17. TheFish says:

    Thanks, I’m going to use the code in my nixy tube clock, still waiting for my new pic micro controllers to come in from sparkfun, but so far so good, if i decide to add an alarm function to it then ill send you the new code.

  18. kiran says:

    please tell me that which ic will work better,PIC 16F84 OR PIC16F84A.

    from kiran

  19. Rudyard Barcena Diaz says:

    Es un Magnifico trabajo y es el mejor sitio que e encontrado con informacion veridica quisiera saber si a la terminal No. 3se le puede agregar una serie de alarmas para tocar un timbre de escuelas los eventos son 07:00 07:50 08:40 09:30 10:20 10:35 10:40 11:30 12:20 13:10 13:30 14:20 15:10 16:00 16:50 17:05 17:10 18:00 18:50 19:40 y que su duracion fuera de 5seg por evento les agradesco su informacion si requieren lo pcb del circuito de reloj y de los displays con gusto se los enviare gracias

  20. Kiran Patil says:

    can u please tel me the cost price of 16F84 microcontroller in indian rupee……………….
    from kiran

  21. kiran says:

    i dont have a rs232 cable. can i use the pin which has both sided rs232 type pin.but i can connect it to my pc.

    thankyou ,
    from kiran

  22. Mae says:

    can i ask if it is ok to change the 7 segment size, i will make it 7 segment (5inch)?

  23. Rudyard Barcena Diaz says:

    Malas noticias este reloj se ADELANDA U MINUTO POR DIA

  24. Danim says:

    Hello, my problem that the clock forward a few seconds per day. How I can adjust the .asm code.

  25. deleng says:

    kiran :hi!!!!!!!!!!!please tell me that which ic will work better,PIC 16F84 OR PIC16F84A.
    thankyou,from kiran

    hi kiran!

    as on my experience using this microcontroller in my robot arm, I do prefer the PIC16f84. I do have a problem on PIC16f84A on the porta side. I can’t figure out why it can not set a pulse.


  26. deleng says:

    kiran :hi!!!!!!!!!!!!!!!i dont have a rs232 cable. can i use the pin which has both sided rs232 type pin.but i can connect it to my pc.
    thankyou ,from kiran

    hello there again Kiran!

    you can use a usb to rs232 port which can be bought on any computer or comp. accessory booth that can suit on your computer…


  27. kantorman says:

    when we try the program it just counts 1-9 and all of the seven segments were counting at the same time. can anyone help us with this?

  28. HIIIIIIIIIIII can you tell me the basic ipplemention of digital circuit diagram????????

  29. alex says:

    PIC16F84 12 or 24 Hour Digital Clock Circuit
    hi i liked very much your project. can you please tell me if you can make it with a button to change it from clock to time counter?

  30. Haybist says:

    Has anyone had any luck making this work? I need an alternative for the transistors.

  31. SAPTASWA DHARA says:

    Actually what I need one lamp will glow regularly say from 6 pm to 10 pm and another from 9pm to 6 am as per choose.

  32. intissar says:

    s’il vous plait comment je peut connecter 38 afficheurs 7 segment au microcontroleur 16f877(comment mettre 152 broches dans 32 entrées)
    svp j’attend votre reponse pour mon projet
    merci d’avance.

  33. Batnasan says:

    can u send me pcb?? really need

  34. Misha says:

    I need some help to make this schematic and hex to work with Common Anode display type please… i made the schmeatic with CA and not working with the actual HEX file….

    • mahendra says:

      You just need by some modification you must used 7 inverter or not gates in between7 seg common anode led display and output of 16f84a

  35. roy says:

    I have to make a PIC based project related to the field of instrumentation and control

  36. StevenWong says:

    Can send to me the PCB layout, schematic layout, hex file and assembly file? I really interest to this project and i do this project as my final year project.

  37. bolor says:

    how use that?
    So what is this range of use ?

  38. Fred says:

    Wha type of transistor are you using NPN or PNP?

    Thank s fred

  39. hoy many volts of capacitor.?

  40. munna says:

    this clock circuit diagram is very nice. Weal com

  41. prasanna says:

    learn circuit

  42. Sahan says:

    hi i think this is cool one stil im not make it but soon as posible im going to do it. in fact i have little problem, can anyone please tell me how do i change 12 and 24 hours ? there is no switch (push button) for it.

    thank you for your comments…….

  43. Arne says:

    Sahan :
    can anyone please tell me how do i change 12 and 24 hours ? there is no switch (push button) for it.
    thank you for your comments…….

    There are 2 hex-files, one for 24h and one for 12h. You must chose when programming the chip.

  44. Arne says:

    The decimal point lights on your pictures, but I can not see where it is connected on the schematics. Where is it connected and how?

  45. atmelfreak says:

    Does it also works with a pic16f627,628 or 876?

  46. jaskirt says:

    hello sir

    the hex file not proper working.7 Segment Display show only 8 .plz soluition this problum and resend hex file 12 hour,

  47. jaskirt says:

    plz help me. i m making a digital clock on a pic based.. i installed a program in microcontroler..bt display showing only 8 digit num, i didnt understand wat is this prob and how to solve it…

  48. khalid tubail says:

    can any one submit the proteu simulation file for this project

  49. Manfred says:

    Is there anyone here who knows how to add zulu time as well as a timer and stop watch?

  50. serkan says:

    Clock is so simple and works good but it’s going FAST! Transistors are ss9014 appropriate.
    Request adjusting xtall,etc.

  51. serkan karaaslan says:

    Dear Sirs,
    I mad this circuit but it goes fast.(2 min. a day)
    How can I solve this problem. Thanks,

  52. serkan says:

    Nice work really but it goes fast! For newbies asm codes are not meaningful. How can we adjust accuracy and how can add rtc? Thanks a lot..

  53. faizan says:

    how to check if the PIC is properly installed?

  54. Don DeGregori says:

    I would like to use a PIC16F628A. I haven’t been able to compile. Could you tell me what changes I should make in memory locations, or configuration.

  55. Iyad says:

    what should i change if i used common anode. 7 seg display.


  56. Ion says:

    @Arne: “The decimal point lights on your pictures, but I can not see where it is connected on the schematics. Where is it connected and how?”

    To make the DP work, change the schematic: break the connection between pin 6 of the PIC and R8 and instead connect R8 to 7805’s out (pin 14 of the PIC). You won’t need to change the code or anything else (I’m using the 24h one).

  57. Le Dac Luyen says:

    Can i replace PIC16F84 by PIC16F628A because i only have PIC16F628A? can you post HEX file for it. Thank you very much !

  58. Ronit Dutta says:

    I used PIC 16F84A IC, my clock is not working.

  59. Ronit Dutta says:

    I have made this nice digital clock.
    But it goes 2minutes fast per day.
    Give me solution.

  60. michelle says:

    what is the pin configuration of C828?

  61. Godwin says:

    Pls hw do I get the display led is it sold in d market already coupled or am to construct it

  62. usman says:

    how to select 12 or 24 hours mode?

  63. abu baker says:

    any body can send me the pic16f84a based digital clock with c code # Baker#

  64. bandara says:

    Hi please send the details for big 7 segment clock (only hex file)

  65. kushan says:

    i got prob!can anyone help me?seconds indicating led blink accurately but not indicate time on 7 segments.

  66. David says:

    Hi, I have built your digital clock and all working fine thanks except that its gaining something like 2 minutes in about 5 days.

    Is there away of correcting this in the code ASM file before creating the HEX.

    If so could you possibly show me what to do please.

    73s Dave

  67. Jonas says:

    I am new to this, so i faced a problem how to connect VDD/VCC pins from PIC?

  68. Anze says:

    Could you explain to me, how does PB1 and PB2 works?
    And at what speed should I switch displays?

  69. Bandu says:

    that’s very interesting.
    etching a pcb is also a simple work.
    the way of current flow of 7 segment LED Panel is always to one direction.eg common anode or common cathode. can be controlled by changing the polarity of the out put pulse . eg 00111111 and 11000000 by inverting.
    can use pnp or npn transistors to withstand the load of wach 7 segment LED panel by installing the collector of the npn transistor directly to the positive rail and getting the output from the emitter of the transistor and connecting it to the common electrode of the 7 segment led panel.
    and if you try to use pnp transistors, the load supplies from the common anode must be fed to the emitter of the pnp transistor and the collector must be connected to the negative rail.

    i am very much interesting to follow a frequency counter circuit to measure 50.000,000 Hz as maximum reading.let me know how the timer0 and int must be configured to use the frequency counter please.

    thanks and good luck.

  70. Bandu says:

    Don’t worry to use a vero board to assemble the circuit diagram. use a small piece of emery paper and clean all the layers first.
    use a sharp scalpel to cut the unwanted lengths and connections of the vero strips. or else use a dotted board and make each and very wiring by using good quality circuit wire.
    use 0.8mm good quality solder wire.
    try to use some solder flux also.
    keep the copy of the wiring diagram in front of you when you do your wiring.
    best of luck.


    I have built the circuit and it worked perfectly. it is a wonderful thing you have done. I will even want you to be my pal for i highly appreciate this work that you have put on the net to encourage others. thank you

  72. Dibyendu says:

    Circuit wearing is same but display is not on what is this problem.

  73. Paulo Violante says:

    I mad this circuit but it goes fast.(2 min. a day)
    How can I solve this problem. Thanks,

  74. Viv Dold says:

    How can I adjust the clock as it gains two minutes everyday?

  75. joelabsalon says:

    Is it okay if I put Yl-501SR-A instead c828?

  76. Mike says:

    Program for 24h is ok.
    Connexions for bases Q1.. Q4 are wrong. So,
    base Q1 ->R=10k -> pin 1 PIC
    base Q2 ->R=10k -> pin 2 PIC
    base Q3 ->R=10K -> pin 17 PIC
    base Q4 ->R=10k -> pin 18 PIC
    For Q1… Q4 i used BC546
    For display i used 2X DC56-11GWA (dual LED dispaly, green)

  77. khinmyoayekma7 says:

    i am abeginner- but i interested that program -so,may i get a source code ,pls?

1 Pings/Trackbacks for "PIC 16F84 12 24 Hour Digital Clock Circuit And Programming"

Leave a Reply

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



Enter your email address: