Skip to content
Electronic Circuits

DIY Hobby projects, diagram, schematic

Electronic Circuits

DIY Hobby projects, diagram, schematic

PIC 16F84 12 24 Hour Digital Clock Circuit And Programming

electronicecircuits, July 11, 2010August 16, 2023
PIC 16F84 12 24 Hour Clock

PIC16F84 12 or 24 Hour Digital Clock Circuit Diagram And Programming

This PIC digital clock circuit 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
PARTS LIST
R1 – R8100Ω
R910kΩ
R10 R1310kΩ
C122pF
C222pF
D1LED
U1 – U4Common Cathode 7 Segment Display
Q1 – Q4C828
Xtal14 MHz Crystal
IC17805 Regulator IC
PIC1PIC 16F84 OR PIC16F84A
PB1 -PB3Push to ON push button switch

PB1 for set minutes.

PB2 for set hours.

PB3 for Reset.

D1 LED indicate seconds.

Notes:

  • Design this circuit diagram on veroboard or pcb using 18 pin IC base.
  • Program your PIC (pic16f84 or pic16f84a) using PIC Programmer with ic-prog programmer software and this .HEX file. You can follow these instructions.
  • Install PIC on IC base.
  • Supply power to your circuit and set time using PB1 and PB2.

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 ClockPIC 16F84 PIC16F84A 12 24 Hour DIGITAL Clock

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

Electronic Circuits IC ProgrammingPICPower Amplifier

Post navigation

Previous post
Next post

Comments (86)

  1. ultrasound technician says:
    July 21, 2010 at 1:56 pm

    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!

    Reply
    1. kushan says:
      October 10, 2014 at 3:01 pm

      seconds led indicate accurately but time is not display.why can help me

      Reply
      1. ahmad tariq says:
        May 17, 2015 at 12:50 pm

        i also try this n i have same problem i think that problem in 16f84 ic programs if u find it plz reply me
        thank u

        Reply
  2. Certified Nursing Assistant says:
    July 23, 2010 at 9:36 am

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

    Reply
  3. SOLOMON ADAH says:
    August 1, 2010 at 9:12 am

    nice work, i needed just that for my project.

    Reply
  4. bmx wheels says:
    August 27, 2010 at 8:00 am

    nice, thank you so much 😉

    Reply
  5. ryan says:
    October 1, 2010 at 8:03 pm

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

    Reply
  6. Kilroy says:
    November 4, 2010 at 5:42 am

    can u send me the pcb file plx

    Reply
  7. Sofa King says:
    January 18, 2011 at 3:15 pm

    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.

    Reply
  8. srihari says:
    January 24, 2011 at 12:47 pm

    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….

    Reply
    1. Lahiru says:
      October 13, 2013 at 4:58 pm

      please post the pin configuration of c828

      Reply
    2. Jaspreet singh says:
      July 12, 2014 at 6:00 pm

      Hi There
      I have also constructed this clock and facing same Problem ,Have you find any Solution for this Problem.Pls Reply on my Email mailjrooprai@gmail.com .Thanks in advance.

      Yours
      Jaspreet singh

      Reply
  9. pido says:
    January 29, 2011 at 9:07 pm

    c828 is npn or pnp transistor?

    Reply
    1. Ronit Dutta says:
      September 4, 2013 at 1:43 pm

      npn Transistor

      Reply
      1. NILANJAN ROY says:
        February 9, 2014 at 11:43 am

        can i use bc 557 or BC 547 or BC548 ??

        Reply
        1. Fung says:
          November 8, 2014 at 12:00 pm

          Collector current of BC546, 547 and 548 is 100mA. For small displays it is okay to use BC547 or 548, while for larger displays it is recommended to use BC337 or 338 which their collector current is 800mA. You may also use ULN2003 or ULN2803 instead of individual transistors.

          BC557 is PNP so it is not suitable in this circuit.

          Reply
  10. sara says:
    February 1, 2011 at 5:03 am

    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?

    Reply
  11. luqman yousaf says:
    March 7, 2011 at 11:44 pm

    nice work i made it

    Reply
  12. Dessy says:
    March 30, 2011 at 5:37 pm

    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

    Reply
  13. Alberto Vazquez says:
    April 13, 2011 at 2:43 am

    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.

    Alberto

    Reply
  14. Avik says:
    April 29, 2011 at 10:56 am

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

    Reply
  15. Avik says:
    May 8, 2011 at 3:08 am

    can anyone convert this hex codes for 16f628a?

    Reply
  16. arun says:
    July 1, 2011 at 11:58 am

    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.

    Reply
  17. TheFish says:
    July 27, 2011 at 2:12 am

    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.

    Reply
  18. kiran says:
    August 1, 2011 at 4:40 pm

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

    thankyou,
    from kiran

    Reply
  19. Rudyard Barcena Diaz says:
    August 3, 2011 at 8:53 am

    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

    Reply
  20. Kiran Patil says:
    August 6, 2011 at 11:59 am

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

    Reply
    1. Ronit Dutta says:
      September 4, 2013 at 1:46 pm

      100Rupees

      Reply
  21. kiran says:
    August 9, 2011 at 5:03 pm

    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

    Reply
  22. Mae says:
    September 10, 2011 at 11:41 am

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

    Reply
  23. Rudyard Barcena Diaz says:
    September 15, 2011 at 7:51 am

    Malas noticias este reloj se ADELANDA U MINUTO POR DIA

    Reply
  24. Danim says:
    September 19, 2011 at 7:55 pm

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

    Reply
  25. deleng says:
    September 28, 2011 at 1:57 pm

    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.

    thanks!
    -deleng

    Reply
  26. deleng says:
    September 28, 2011 at 2:01 pm

    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…

    thanks!
    -deleng

    Reply
  27. kantorman says:
    October 2, 2011 at 5:02 pm

    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?

    Reply
  28. zahid hussain says:
    November 27, 2011 at 1:52 pm

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

    Reply
  29. alex says:
    January 25, 2012 at 10:18 pm

    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?

    Reply
  30. Haybist says:
    February 10, 2012 at 10:28 pm

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

    Reply
  31. SAPTASWA DHARA says:
    February 28, 2012 at 8:11 pm

    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.

    Reply
  32. intissar says:
    April 8, 2012 at 5:46 pm

    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.

    Reply
  33. Batnasan says:
    April 17, 2012 at 10:08 am

    can u send me pcb?? really need

    Reply
  34. Misha says:
    April 19, 2012 at 5:15 am

    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….

    Reply
  35. roy says:
    May 5, 2012 at 4:19 pm

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

    Reply
  36. StevenWong says:
    May 12, 2012 at 11:35 am

    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.

    Reply
  37. bolor says:
    May 23, 2012 at 10:46 am

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

    Reply
  38. Fred says:
    June 5, 2012 at 3:35 pm

    Wha type of transistor are you using NPN or PNP?

    Thank s fred

    Reply
  39. rodel mendoza says:
    July 12, 2012 at 7:00 pm

    hoy many volts of capacitor.?

    Reply
  40. munna says:
    July 22, 2012 at 1:42 pm

    hi
    this clock circuit diagram is very nice. Weal com

    Reply
  41. prasanna says:
    September 7, 2012 at 9:50 pm

    learn circuit

    Reply
  42. Sahan says:
    October 5, 2012 at 4:26 pm

    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…….
    t.c

    Reply
  43. Arne says:
    December 2, 2012 at 7:04 pm

    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…….
    t.c

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

    Reply
  44. Arne says:
    December 3, 2012 at 3:00 pm

    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?

    Reply
  45. atmelfreak says:
    January 4, 2013 at 9:58 pm

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

    Reply
  46. jaskirt says:
    February 7, 2013 at 2:55 pm

    hello sir

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

    Reply
  47. jaskirt says:
    February 10, 2013 at 10:04 pm

    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…

    Reply
  48. khalid tubail says:
    February 11, 2013 at 12:47 am

    can any one submit the proteu simulation file for this project

    Reply
  49. Manfred says:
    February 13, 2013 at 5:32 pm

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

    Reply
  50. serkan says:
    April 15, 2013 at 4:46 pm

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

    Reply
  51. serkan karaaslan says:
    April 17, 2013 at 3:07 am

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

    Reply
  52. serkan says:
    April 20, 2013 at 5:35 pm

    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..

    Reply
  53. faizan says:
    May 13, 2013 at 12:35 pm

    how to check if the PIC is properly installed?

    Reply
  54. Don DeGregori says:
    May 29, 2013 at 3:08 am

    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.

    Reply
  55. Iyad says:
    July 11, 2013 at 8:44 pm

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

    thanks

    Reply
  56. Ion says:
    August 10, 2013 at 8:08 pm

    @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).

    Reply
  57. Le Dac Luyen says:
    August 16, 2013 at 9:40 pm

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

    Reply
  58. Ronit Dutta says:
    August 21, 2013 at 10:40 pm

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

    Reply
    1. michelle says:
      September 22, 2013 at 4:54 pm

      did your 16F84A worked now? i have the same microcontroller.

      Reply
  59. Ronit Dutta says:
    September 16, 2013 at 2:49 pm

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

    Reply
  60. michelle says:
    September 22, 2013 at 4:51 pm

    what is the pin configuration of C828?

    Reply
  61. Godwin says:
    February 21, 2014 at 3:06 pm

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

    Reply
  62. usman says:
    March 9, 2014 at 12:37 am

    how to select 12 or 24 hours mode?

    Reply
  63. abu baker says:
    July 11, 2014 at 12:20 pm

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

    Reply
  64. Pingback: Rise and Shine Alarm Clock | Hashini Reveals
  65. bandara says:
    September 30, 2014 at 9:57 pm

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

    Reply
  66. kushan says:
    October 10, 2014 at 2:59 pm

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

    Reply
  67. David says:
    November 14, 2014 at 11:31 pm

    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

    Reply
  68. Jonas says:
    December 6, 2014 at 5:03 pm

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

    Reply
  69. Anze says:
    December 17, 2014 at 8:25 pm

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

    Reply
  70. Bandu says:
    December 26, 2014 at 7:02 pm

    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.
    Bandula

    Reply
  71. Bandu says:
    December 26, 2014 at 7:15 pm

    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.
    bandu

    Reply
  72. ARIYO AYODEJI OLUSOLA says:
    January 11, 2015 at 6:39 am

    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

    Reply
  73. Dibyendu says:
    February 9, 2015 at 9:37 pm

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

    Reply
  74. Paulo Violante says:
    March 12, 2015 at 3:29 am

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

    Reply
  75. Viv Dold says:
    April 15, 2015 at 7:12 pm

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

    Reply
  76. joelabsalon says:
    June 2, 2015 at 11:58 am

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

    Reply
    1. joelabsalon says:
      June 2, 2015 at 12:11 pm

      sorry i was wrong. 🙂

      Reply

Leave a Reply Cancel reply

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

  • Diagrams
  • Privacy Policy
  • Software
  • Contact

Recent Posts

  • LM317 CONSTANT CURRENT CALCULATOR
  • 5V buck converter – LM2576 simple DIY project
  • ICL7107 PANEL METER
  • Precision 1Hz clock generator circuit
  • Toggle to Momentary Switch Using 555 Monostable

Categories

  • Circuit Tutorials
  • Electronic Circuits
  • Electronic Software

AC Projects Alarm Circuits Amplifier Circuits Amplifiers Antenna Circuits Battery Charger Calculator software Circuit Designer Control Circuits Converter circuits Crossover Circuits Data Sheets Digital Circuits Electronic Switch Flasher Circuits Game Circuits IC Programmer IC Programming Indicator Circuits LED Circuits Light Circuits Logic Circuits Measuring Circuits Meter Circuits Microchip Motor Circuits Music Circuits Oscillator Circuits PCB Designer PIC Power Amplifier Power Guard Power Supply PreAmplifier Circuits Radio Circuits Regulator Circuits Regulator Diagrams Regulator Schematics RF Schematics Sensor Circuits Tester Circuits Timer Circuits Transmitter Circuits Tutorials Vacuum Tube

©2025 Electronic Circuits | WordPress Theme by SuperbThemes