Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Digital Clock Questions

Status
Not open for further replies.

adamthole

New Member
I am working on a project similar to your standard digital clock. From what I have been reading it sounds like the best way to make an internal RTC with a PIC16LF88 is by using timer1 or timer2. It also sounds like to get a descent accuracy I am going to want to use an external crystal as opposed to the internal RC clock. If I did use the internal RC clock, can anyone estimate how many minutes I would lose a day or month, assuming my code was correct?

My primary concern for this clock is for it to have a low power consumption. I have been reading about the "RC_RUN" and "SEC_RUN" features of the 16F88...still working on fully understanding those. If anyone has any good sources to complement the datasheet, it would be helpful. If not, I can probably figure it out.

I would like to power the entire project from a 3V source. I was originally going to use a 2 line LCD display for the output, but as far as I know they only come in 5V versions. Does anyone know of a good low-power display that can run off of 3V?

I am going to have the display off until the user presses a button, where it will come on for 30 seconds. I am planning on powering the display directly from a pin on the chip. According to the datasheet the 16F88 can source a maximum of 25mA on an I/O pin, so it should handle any display I use. Anyone disagree? (Keep in mind, it will be a low-powered display)

The plan is for this to be used in outdoor conditions, any suggestions on waterproofing?
 
You NEED a crystal, the internal oscillator is only RC, and will drift far too much for a clock, particularly outside. I would suggest using TMR2, and in fact I've posted partial TMR2 clock routines previously in this forum.
 
I realize that the RC will drift, but it still may work for my purposes. I am not going to be displaying the time, I just need a rough estimate of what time it is, basically what day it is. Any estimates on how much it will drift a day? I will probably end up using a crystal anyway, but I would still like to know the drift out of curiosity.
 
As Nigel says, you will need a crystal but not necessarily for the main clock. I would suggest that you use the internal RC oscillator (at low speed) and an external 32kHz watch crystal on timer 1. This allows you to set the CCP module in Special Event Trigger mode and get a 1 second interrupt. The only down side to doing it this way is that you won't be able to use an ICD2 (Inchworm) as timer1 oscillator and the IDC share the same pins.

If you only use the internal oscillator, your clock will be out by about 20 minutes per day!!

Mike.
 
I agree with Mike (Pommie) about using a 32-KHz crystal and the Timer 1 module in oscillator mode. I'm not sure I'd use the special event trigger though. It seems the Timer 1 / 32-KHz xtal setup will keep running during 'sleep' and wake-up on overflow so that's a big power savings advantage.

As for how far off the INTOSC will be -- I experimented with this using my soft' timer "trim" routine that I normally use with my xtal based clocks and I found I couldn't "trim" the timer because it drifted both up and down significantly even when the project board was in a reasonably stable room temperature environment. It often would drift several minutes per hour.
 
Hi Mike,

I hadn't noticed the RTC code in the data sheet before and hadn't thought of setting bit 7 of TMR1H. When I did this a few years ago, I used a 38K crystal and so the Special Event Trigger made more sense.

To the OP, forget about the S.E.T. and just use the code supplied in the data sheet.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top