Page 1 of 1
Wacth
Posted: Wed Jun 15, 2011 9:22 am
by jgu1
Hi Team!
I am trying to make a simple wacth. I use a Pic18f4525 on EB006 board and 19.0668 Mhz Xtal. But already after few minute I lose second“s. Please would some of your expert be so kind to check the program and se if I made some fault. I suspect the hardware (Xtal).
Best regard
Jgu1
Re: Wacth
Posted: Wed Jun 15, 2011 10:01 am
by Benj
Hello,
I have made a couple of minor mods to your program and hopefully it should now run correctly for you. I think the problem before was that you were calling the display macro from the interrupt which means you may be in the interrupt routine too long and miss timer counts.
I also moved the reset of the timer count variable as there was a possibility that it would not be reset which again would lead to the timer not counting the time correctly.
Re: Wacth
Posted: Wed Jun 15, 2011 11:05 am
by jgu1
Hi Ben
Unfortunately did not help. I must try to change the crystal, it may well be not running as it should. But otherwise, many thanks for your help.
Best regard
Jgu1

Re: Wacth
Posted: Wed Jun 15, 2011 1:38 pm
by medelec35
Before you change crystal, try this version.
The problem you had with your Flowchart is you 1st check to see if seconds = 60, then if not the seconds are incremented by 1. So if seconds = 59 then 1 is added to the second.
This means that each minute is incremented every 61 seconds and not every 60 seconds.
So to correct I have changed Sek=60 to Sek=59 and same with mins. Normaly you add 1 to seconds, then check to see if seconds = 60.
I have also completed some other minor alterations.
Martin
Re: Wacth
Posted: Thu Jun 16, 2011 8:39 am
by jgu1
Hi medelec.
Yes, yes. Now fit the time, 100% Even small mistakes can have large fluctuations.
Now I can get on with the project. I must have created the opportunity to set the time, but it's no problem.
So far many thanks for the quick response and help when I find out how to do, you get many stars.
Best regard
jgu1