July 9, 2026

The Dallas 1-wire protocol saga -- date and time from the DS1994

We can read 5 bytes from the DS1994 that are described as a "real-time counter".
Data 514 0x0202: c1 -- A week ago
Data 515 0x0203: 6b
Data 516 0x0204: 6e
Data 517 0x0205: 43
Data 518 0x0206: 0a

Data 514 0202: 67 -- yesterday
Data 515 0203: 50
Data 516 0204: 28
Data 517 0205: 4e
Data 518 0206: 0a

Data 514 0202: 2a -- today (just now)
Data 515 0203: 2c
Data 516 0204: 79
Data 517 0205: 4f
Data 518 0206: 0a
I just executed the time() system call on my linux system, and it gives me this:
0x6a518a80
Linux counts time in seconds since January 1, 1970 -- sadly there is no easy match to the value in the DS1994 I have.

The DS1994 datasheet tells us that the clock ticks 256 times per second. So the LSB accumulates these fractional seconds. The upper 4 bytes are a count in seconds, so we have:

0x0a4f792c
In other words, some time more recent that January 1, 1970 was selected as zero.

I convert these times in seconds to times in years:

Time: 1783729998
Time: 6a518f4e
Time (years): 56.562
DS time: a4f792c
DS time: 172980524
DS time (years): 5.485
This is July 10, 2026, and it seems reasonable that this would be 0.562 of a year. 2026 - 56 does give us 1970.

For the DS1994, we can say 0.485 is close enough to to 0.562 to ignore. It really isn't, but we say that for now -- then 2026 - 5 = 2021. So this value was set to zero around February 1, 2021. More likely the chip just started counting from zero on (more or less) February, 2021.

The date code on the chip (coin) is 1943. So it was manufactured in 2019. Apparently the chip started counting about 2 years later.

I have worked with other chips that don't start counting until the first time they are accessed. This avoids draining the battery when the chip is in storage. I have not seen a statement of this sort in the datasheet.

The control register in the DS1994 does have a bit to enable the oscillator. It would seem that some software enabled this bit (in February of 2021) without setting a value in the real-time counter, so it has just been counting from zero ever since.


Have any comments? Questions? Drop me a line!

Tom's software pages / tom@mmto.org