Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Use PIC microcontroller for Time application

  1. Aug 11, 2008 #1

    I want to make a project to switch-n a device on day-date-time basis i.e. I want to lighup a lamp on 30/08/2008 at 02:00PM .Is it possible to make a circuit for this by using PIC microcontroller.I want to use it in my company for rotational under frequency relay which trips off the output feeder by getting an external input pulse and check for date/time for operation of PIC output i.e. which output should be trip as per current day/time?.

    Kindly reply pleaseeeeeeeeeeeeeeeeeeeee.....

  2. jcsd
  3. Aug 11, 2008 #2


    User Avatar

    Staff: Mentor

    The best way to do that is to use a Real Time Clock module that the PIC can read:


    Dallas Semiconductor makes RTCs, for example.

  4. Aug 12, 2008 #3


    User Avatar
    Science Advisor

    Assuming you're not doing anything else that's really time critical, you can also implement a real-time clock using the on-board timer (note that the accuracy will depend on the accuracy of your oscillator--you won't be able to keep track of time long term if your oscillator is not accurate). See the Microchip documentation (there should be a generic timer section, as well as subsections for each of the usually-dependent timers) for more details, but a decent way of doing it is to trigger an interrupt every (few?) second(s) and have an accumulator somewhere which keeps track of the time.

    Random trivia: if you're using a RTC: a 32.768 kHz crystal is usually used because 32,768 is 2^15, which makes (EE) life really simple--assuming you had to keep track of individual pulses yourself.
  5. Aug 12, 2008 #4
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook