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.

Time measuring with 16f877

Status
Not open for further replies.

PIC2PIC

New Member
Hi

I made a device that counts the time, something like a clock. And I use Watch Dog Timer to count seconds.But the problem is accuracy, i.e. for every minute my clock is fast about 1 second.

I use PIC 16f877.

So I have 2 questions:

1. Is there a better and more accurate way to count seconds or smaler fractions of seconds then to use WDT
2. In assembly code I try to improve accuracy in every minute by substracting one second after every 61
"Seconds" ,but strange thing happen. I regulate memory bank for each register, but in a
dissassembly listing in MPLAB is shown that the address of the memory register that I use is some other bank
diferent then I set, and that means some other memory register, and I can't do nothing to change that .
What could be reason for this?
 

ericgibbs

Well-Known Member
Most Helpful Member
hi,
Use Timer1 for your 'timed' interrupt, not the WD timer.

Whats the crystal frequency.?
 

blueroomelectronics

Well-Known Member
Some good reading for a zero error 1 second clock when using a 4MHz crystal.
Zero-error 1 second timing algorithm
8493-onesec01.gif
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top