Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Is it possible to make a real time clock using timers in any microcontroller??

Status
Not open for further replies.

deepshah3

Junior Member level 1
Joined
Jan 30, 2018
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
161
Is it possible to make a digital real time clock using the timers of microcontrollers?
PS:I am planning to make it using a simple PIC controller or 8051.
Is it possible to make the clock along with multiple alarm settings?
 

Yes, you can make a digital real time clock using timers of microcontrollers, if you know the crystal clock frequency being fed to the timer and then just keep counting number of clock cycles to make 1 second.
From seconds you can derive minutes and then hour in the similar manner.

what alarm settings you want in your design ?
 

    V

    Points: 2
    Helpful Answer Positive Rating
Well..what i want is not exactly an alarm setting..
I want to make the clock with multiple ON OFF time settings..
So i want that I can enter multiple on & off times and the real time keeps running simultaneously..
Is that possible??
 

By RTC it is meant an oscillator operating precisely at a frequency as accurate as a crystal is able to provide, preferably a multiple power of 2 so that the simple overflow of a timer with or without pre-scaler is sufficient to generate that timing. A crystal has an acuracy in the range of a few ppm's, and if you try to get that timing through the usual calculation rules of timers, you run the risk of not considering the instruction execution time at the input and output of the associated interrupt to reload specific values, and the expected time will be increased by some uncertainty. I personally have never been able to find any other crystal than 32,768Hz for such a task, but the price of that solution is either the need for your uC to have a second crystal oscillator built in, or to have to get it through an external oscillator.
 
With the price of hardware RTC, or even microcontrollers with a built-in RTC, typing to use something else can be a 'road to nowhere'.
Also consider how long you expect the system to be 'accurate' (to whatever degree is applicable to your function). As mentioned above this is normally limited to the accuracy of the crystal. Even a crystal that is accurate to 1PPM will drift by about 0.09 seconds a day: whether that is OK for you depends on what you need and how long it will be running.
In the devices that have needed an RTC that remains 'accurate' for weeks, I've often been able to include a network interface and reset the clock using an NTP client. I know this is not always possible but the IoT network devices can be very cheap these days which can be an easy design trade off.
Also consider using a TCXO to get better accuracy over a longer period.
Susan
 
Hi,

. I personally have never been able to find any other crystal than 32,768Hz for such a task,
Many microcontroller may generate a divided input clock signal by the use of timer/counter periferal.
This can be achived without influence of instruction time.
Then you may use any crystal for this. This your RTC will be as precise as the input clock.

The problem with the microcontroller solution is... when power is lost. It will loose absolute time information.
Here is the benefit of external RTC circuits...they have their own power supply, usually a coin cell to keep absolute time and keep on counting.

Klaus
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top