Electronics > Projects, Designs, and Technical Stuff
If you get to choose, which type of RTC chip would you prefer to use?
technix:
--- Quote from: Gribo on February 04, 2020, 07:50:55 pm ---A GPS module.
--- End quote ---
This has a high power draw, and requires signal reception though.
--- Quote from: nctnico on February 04, 2020, 10:00:45 am ---One thing to look out for is that your RTC supports dates beyond 2038. A 32 bit counter may be of use if you can use it unsigned otherwise your gadget will run into trouble in less than 20 years.
--- End quote ---
It is very doable to detect the overflowing and use some battery-backed SRAM to provide a few extended bits. Then for the internal code sign extend that into a 64-bit signed time_t. Even a 40-bit UNIX timestamp won't overflow before the devices cease to function if started now.
ejeffrey:
The only reason I can think for wanting a BCD counter is if you were just using it to drive a display with minimal logic. If you want to do any timekeeping duties in a microcontroller it seems like keeping a binary timer and converting to the appropriate format for IO makes more sense.
aix:
--- Quote from: nctnico on February 04, 2020, 10:00:45 am ---A 32 bit counter may be of use if you can use it unsigned otherwise your gadget will run into trouble in less than 20 years.
--- End quote ---
With respect, that's not necessarily true. It all depends on how the code that receives that (potentially negative) number chooses to interpret it. If the OP is the person writing that code, they potentially have quite a bit of leeway here. (It could be as simple as casting the signed number to unsigned.)
NivagSwerdna:
FWIW one advantage of having a separate time keeper is that it keeps time even when the main uP is unavailable... specifically during firmware update... depends on your requirements I guess.
nctnico:
--- Quote from: aix on February 05, 2020, 06:34:37 am ---
--- Quote from: nctnico on February 04, 2020, 10:00:45 am ---A 32 bit counter may be of use if you can use it unsigned otherwise your gadget will run into trouble in less than 20 years.
--- End quote ---
With respect, that's not necessarily true. It all depends on how the code that receives that (potentially negative) number chooses to interpret it. If the OP is the person writing that code, they potentially have quite a bit of leeway here. (It could be as simple as casting the signed number to unsigned.)
--- End quote ---
But this can get problematic when you need to add or subtract time. Nowadays I like to avoid working with unsigned numbers. The advantage of using an (signed) 64 bit integer is that you can keep the time in milli-seconds.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version