Perkoperkins, sorry for the delay but in summer months I don’t work with PBP on a daily basses. I’ve looked over your BCD to DEC and I have some points to cover.
(clkday>>4*10) Look at the data sheet. Reg 03h day, this is a good example. You are shifting right then multiplying OSCON and VBAT by 10. Reg 03h will only require (clkday & %00001111). Check all your registers to insure your calculations only include relevant data.
Seconds register can be used to enable or disable the oscillator at any time. I load all registers with one pass of the programmer then use a second pass of the programmer to load seconds register only to sink time with the PC as best I can. Without writing a VB program to pull time from the PC I haven’t found a better way to set the clock.
The way your var’s are set up, yes, I think you need to update variable on each new pass of GetTime however this is not necessary if you change some variable structure. Look at some of Darrel Taylor’s links on this subject. The commented second line in GetTime will update, but Darrel’s is a technique you should try. External Modifiers
Darrel also explains using external modifiers which I think is a good practice. This will update your variables when you use GetTime and use the first line for i2cread.
I'll look over some more of your program when I have time.Code:ClkBuffer var byte [9] ASM ClkSec var byte = _ClkBuffer ClkMin var byte = _ClkBuffer + 1 ClkHour var byte = _ClkBuffer + 2 ClkDay var byte = _ClkBuffer + 3 …. …. END ASM ClkSec var byte ext ClkMin var byte ext ClkHour var byte ext ClkDay var byte ext … …
Wayne




Bookmarks