zerog2k / stc_diyclock

STC DIY Clock redux (STC15F204EA, STC15W404AS, STC15W408AS)
MIT License
171 stars 66 forks source link

Don't overflow the 8 bit counter for deciseconds. #10

Closed hachi closed 8 years ago

hachi commented 8 years ago

This prevents a stutter of the seconds-colon every 25.6 seconds.

zerog2k commented 8 years ago

Thanks for PR @hachi - due to code constraints (the way we were blinking used a few extra instructions) and the timing of the loop, I decided to fix this a bit differently in commit 5616a96.

zerog2k commented 8 years ago

It's not perfect (changes in loop timing will affect it). I think the right (future) fix is to use one of the timers to manage a tick counter which is fraction of a second and use that, as it would be more stable (and not affected by loop timing).

hachi commented 8 years ago

I did start attempting to use Timer1 to do that, but I botched the code and fell asleep. So you got the basic suggestion first.

I'm glad to get feedback like this from you on my PR. Thanks for the fix :)