Odd timer problem

beny1949

Senior Member
Hello All,

I have been making a binary clock which has been all fine and dandy up until now. I have just finished it, but a problem developed after about 5 minutes of use, which will not go away now.

The clock should wait for the time to increment by 1 minute before making any changes.

What is now happening is that the clock resets its self after about 100ms which i am assuming is the pause after the do until command.

Like i say, there was not problem, this exact code was working for the first 5 ish minutes of testing. and now it wont work even after a reset or re-downloading the program.

<code><pre><font size=2 face='Courier'>
Symbol Hours = b0
Symbol Minutes = b1

Init:
let dirsc = 255
Hours = 17
Minutes = 43
timer = 0
settimer 49904 'set the timer to tick every second allowing for code execution
goto SetTime

Main:

Do until timer = 60
pause 100
let b7 = timer &amp; 1
if b7 = 1 then
high 7
else
low 7
endif
loop
timer = 0
'increment 1 minute on the display

Minutes = Minutes + 1
If Minutes = 60 then
Minutes = 0
Hours = Hours + 1
if Hours = 24 then
Hours = 0
endif
endif

SetTime:

b6 = Minutes rev 8


let outpins = Hours ^ $80
let pinsc = b6
goto Main

</font></pre></code>

any help would be great! Ben
 

MORA99

Senior Member
Havent looked at the code, but check your serin and reset pin connections.
You could include a &quot;disconnect&quot; to stop monitoring the serin, it would then need hard reset to get a new program.
 

hippy

Technical Support
Staff member
Check a Firmware identify works ( hard reset as necessary ) and then download a simple LED flash / SERTXD program to assure yourself the chip does work or that there is a more fundamental problem.
 

beny1949

Senior Member
I am using the 28/40 pin prototype board, so a floating serin is not a problem.

And...

i turned it on today and WAS is working fine for the first few minutes, then it develops the symptoms i previously described.

it will inform me that the firmware version is A.0 (i ordered them the day they came out)

 

beny1949

Senior Member
I had a very quick thought, which was that the batterys are very old and nearly flat...

and so i put some new in, and so far it seems to be working. this may or may not have been the problem, but it has solved it for now!

if it was the problem then the current being drawn by the 5 or so LED's that come on was enough to trigger a reset, and when download mode is entered the LED's go off, removing the problem!

Thanks for your help,

Ben
 

Dippy

Moderator
Lesson learnt I hope?
Checking battery and/or connections is pretty high up on the fault check list.
 
Top