Dallas RTC Reading Strange Hours

Hi, We use the Dallas DS1337 RTC. In general it seems to work OK. However I'm trying to understand a behaviour in which it's possible to read an HOURS register reading of 25. The RTC is initialised for 24 hour operation.

Has anyone come across this behaviour?

TIA, Ken

+====================================+ I hate junk email. Please direct any genuine email to: kenlee at hotpop.com
Reply to
Ken Lee
Loading thread data ...

25 (decimal) is 0x19, or 7pm in real money, Sprow.
Reply to
Sprow

Sorry, I should have been a bit more precise with my description of the data for those who are not familiar with this type of device. The Dallas DS1337 as with other similar RTC's (eg Philips PCF8563, etc) express the time/date in the registers in BCD form. So I really meant

25 in BCD.

Ken.

+====================================+ I hate junk email. Please direct any genuine email to: kenlee at hotpop.com
Reply to
Ken Lee

Are you sure that there isn't a binary/BCD bit in the configuration register as found on the DS12C887?

Andrew

Reply to
Andrew Jackson

Hi, These particular devices are hardcoded to work only in BCD (for calendar & time). I'm speculating that there's some (missing) initialisation condition or illegal value that may cause the device to operate in such as manner. Apart from that, the equipment with the DS1337 appears to be operating and displaying the correct date/time the majority of the time. Basically I'm trying to capture or understand the error condition that could get the DS1337 into this error state. Although there's no conclusive evidence, the problem was first notice after the equipment was tested under brown-out conditions. I've only looked at the "hours" but these don't seem to recover back to correct operation.

Ken.

+====================================+ I hate junk email. Please direct any genuine email to: kenlee at hotpop.com
Reply to
Ken Lee

I once was getting strange times like 38:17:98, I forgot to convert the BCD to binary and back! Maybe you overlooked that too?

unsigned char BIN2BCD(unsigned char value) { unsigned char x10 = 0; unsigned char x = 0; unsigned char aux;

x10 = (unsigned char) value / 10; x10 *= 16; x = (unsigned char) value % 10; aux = x10 + x;

return aux; }

unsigned char BCD2BIN(unsigned char value) { unsigned char d; unsigned char a;

a = value; d = value & 0x0F; a >>= 4; a &= 0x0F; a *= 10; d += a;

return d; }

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----

formatting link
The #1 Newsgroup Service in the World! >100,000 Newsgroups

---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

Reply to
Blood and Ashes

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.