PDA

View Full Version : Real time clock



PlantBob
- 7th February 2011, 17:49
I am using a PIC18F2450 and need real time clock to schedule events, is this possible in the PIC? if not, is there a 28pin PIC with PIC18F2450 specs and real time clock? Is there an external chip that I could interface with?

gadelhas
- 7th February 2011, 18:00
I am using a PIC18F2450 and need real time clock to schedule events, is this possible in the PIC? if not, is there a 28pin PIC with PIC18F2450 specs and real time clock? Is there an external chip that I could interface with?

Hi;
There are various external RTC Chips. One that is very easy to interface and there are several exemples in this forum is the DS1307. There are some PICs with RTC, go to Microchip site and use the chip selector.

PlantBob
- 8th February 2011, 14:26
Ok, I decided to order a PIC18F24J50 that has an internal RTC, Do you know I set/read the clock?

ScaleRobotics
- 8th February 2011, 14:35
Here is a great example from Bruce:
http://www.picbasic.co.uk/forum/content.php?r=150-18F25J11-RTCC-remappable-pin-options

PlantBob
- 8th February 2011, 14:44
I saw that sample but I am not sure why I would need to remap pins? I not sure if that is there for something else or just for the RTC. Also, do I need external Oscillator and Capacitors for the internal RTC on the 18F24J50?

ScaleRobotics
- 8th February 2011, 14:47
No, you don't need to remap the pins. It is a dual example. He show both " so I'm posting a simple example here showing how to use the RTCC, and how to assign PWM to several pins."

For you, you can just look at the RTC part. :D

From the data sheet under RTCC
• Requirements: external 32.768 kHz clock crystal

' Connect a 32.768 kHz watch crystal between pins 11 & 12 T1CKI & T1OSI
' with caps to match your crystal load capacitance.
' 11 12
' |---||---|
' | xtal |
' _|_ _|_
' ___ ___ 2 x 12pF caps
' | |
' gnd gnd

PlantBob
- 8th February 2011, 19:17
Any idea where I can get the 12.5pf capacitors? I have checked all my online suppliers and can't find them.

ScaleRobotics
- 8th February 2011, 20:00
The 12 pF capacitors should work fine.

Ioannis
- 10th February 2011, 13:01
And if you want the ultimum accuracy, then replace one capacitor with a trimmer (say 6-15pF) to calibrate it.

Ioannis