PDA

View Full Version : question about pic16f877a and 32.768khz crystal



amenoera
- 17th October 2009, 01:04
hii all ,

how can i connect 32.768khz crystal to pic16f877a and write the code with

picbasic pro . i want to make a binary clock so if i used the 4mhz external osc

it will not be accurate enough (15 min per day) .

so can i reduce this by any idea (code or hardware) ?

thanks for help .

regards .

Melanie
- 17th October 2009, 08:38
The Timer1 Section (Section 6) of the Datasheet explains how to do this by connecting the 32kHz xtal to RC0 and RC1 and setting T1OSCEN. Your timekeeping for the Clock will then be by using Timer1 whilst the rest of your program will still be running at 4MHz (or whatever you have).

Acetronics2
- 17th October 2009, 09:38
Hi, Amenorea

Elektor Magazine has published a Binary clock project, some years ago ...

http://www.elektor.com/magazines/2006/july/binary-clock.58374.lynkx

Asm source available ... Programmed processor and PCB too.

But no sleepless nights debugging a tremendous PBP soft ...

Good level Explanations though ...

To get better accuracy, you simply can place fixed + trimmable capacitors on one side of the Xtal ( OSC in side for Gross trim, Osc out side for fine tuning ...)

Whether the choosen OSC ...

OR MUCH BETTER ... use a DCF77 ( or equ.) module to reload absolute time @ regular intervals ...

Alain