Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

(/)

PDF DataSheet PDF - No Registering Required.


OPEN
Maxim Integrated Datasheet. Download PDF Datasheets for Free.
datasheetspdf.com

You are here: Home (/index.php) Projects (/index.php/projects)


PIC Microcontrollers projects (/index.php/projects/category/20-pic-microcontrollers-projects)
Simple Digital Clock

Simple Digital Clock

(/media/com_hikashop/upload/pic16f84_clock_3.jpg)

(/media/com_hikashop/upload/pic16f84_clock_3.jpg)

(/media/com_hikashop/upload/pic16f84_clock_2.jpg)
(/media/com_hikashop/upload/pic16f84_clock_1.jpg)

This is a simple time-of-day digital clock, a good starting point for learning the basics on
microcontrollers. It uses the 18-pin PIC16F84A, a seven-segment LED clock display and three input
switches. The circuit is based on Dan Matthews’s project, initially described on Microchip’s AN-590
(http://ww1.microchip.com/downloads/en/AppNotes/00590c.pdf). Dan Matthews’s project uses a
PIC16C54, so the code has been modified to be used with the more popular PIC16F84A. We almost
preserve the same hardware and we have designed an appropriate printed circuit board for making
construction simple.

The electronic circuit

The individual segments of the display are connected together, A-A-A-A, B-B-B-B, etc. The PORTB pins
activate the LED segments. The connections are RB1-A, RB2-B, RB3-C...RB7-G. The center clock colon
is connected on RB-0.
(/images/projects/pic/simple_clock_pic16f84_electronic_schematic.jpg)
The electronic circuit of the simple digital clock

The common cathode for each display segment is turned on from four I/O lines of PORTA. The
connections are RA0/Digit1, RA1-Digit2, RA2-Digit3, RA3/Digit4 (the display segments are numbered
from the left, or most significant digit).

The switches are also connected to PORTB I/O pins. To read the keys, since we utilize every pin for
output, we switch some of the outputs to inputs briefly. PORTB pins RB1, RB2, and RB3 are pulled low
with 10 KΩ resistors. This value is high enough to not draw current away from the LEDs when they are
being driven on. Inputs are detected by pulling the pins high with a switch to VDD through 820 Ω
resistors. This value is low enough to pull the pin high quickly when the outputs have been turned off,
and to create a 90% of VDD high input.

Operation

The simple digital clock is a 12-hour clock, meaning that there is no distinction between a.m. and p.m.
When no buttons are pressed, the circuit will display the current time, starting at 12:00 on reset.
Pressing SW1 will cause seconds to be displayed. The time is set by pressing SW2 to advance minutes,
and SW3 to advance hours. Since each of the segments are tied together across all displays, only one
display should be turned on at a time, or all displays turned on would display duplicate data. The
displays are turned on right to left, with each display's value being output in its turn. This is done fast
enough so that there is no perceived flicker. The switches are read between display cycles.

Use

The circuit is very small, and therefore can be used as a clock on a bedside table or as an office clock
without using up too much space. The clock can be powered from 4 to 5.5V and consumes about 40 mA
during normal operation (about 0.2W).

Due to its relative high consumption, powering from batteries isn’t a good idea, and you’ll definitely
need a small power supply unit. However, batteries can be used as backup energy source in case of
main power source fail. Using batteries for backup, you will avoid any sudden reset when main power
fails.

For connecting batteries as backup power source, use the reference below (see figure 1).

Figure 1. How to connect backup batteries

Download section
Printed Circuit Board Artwork (/images/projects/pic/simple_digital_clock_pcb.pdf) for the simple digital
clock
Components palcement on the PCB
(/images/projects/pic/simple_clock_components_placement_guide.jpg) - composite drawing
Download the microcontroller's code (/images/projects/pic/clock_16f84.HEX) (hex file)

List of the comments:

No comments have been posted yet.


You must be registered in order to post a comment

Home (http://www.circuitlib.com/) | Contact Us (/index.php/about-us/75-contact) | Contribute


(/index.php/contribute) | Disclaimer (/index.php/disclaimer) | Google+
(https://plus.google.com/112471907220987323673) | Facebook
(https://www.facebook.com/CircuitLibElectronics)

© 2019 CircuitLib Back to Top

You might also like