lightweight RTC object
matb
Posts: 39
Attached is my initial cut at a low resource RTC spin object for comment.
The one I found on Obex used a dedicated cog, which is overkill. The others I found were for external RTC hardware. This version simply uses CNT and a pair of longs to track rollovers. It also uses one Lock. 107 Longs.
This includes its dependency on Bob Belleville's date_time_epoch (in Obex)
To operate correctly it needs to be polled at least twice per CNT rollover period. Since even at 80Mhz this is about 30 seconds, this is not a big deal.
I have plan to eventually implement methods to change the Propeller clock speed. This is required to keep a accurate time when the clock speed changes.
I was prompted to post this since I see Catalina RTC uses the dedicated COG approach. Feel free to steal this idea instead (please!)
It was loosley based on Mathew Brown's RealTimeClock.spin V1.01
m@
The one I found on Obex used a dedicated cog, which is overkill. The others I found were for external RTC hardware. This version simply uses CNT and a pair of longs to track rollovers. It also uses one Lock. 107 Longs.
This includes its dependency on Bob Belleville's date_time_epoch (in Obex)
To operate correctly it needs to be polled at least twice per CNT rollover period. Since even at 80Mhz this is about 30 seconds, this is not a big deal.
I have plan to eventually implement methods to change the Propeller clock speed. This is required to keep a accurate time when the clock speed changes.
I was prompted to post this since I see Catalina RTC uses the dedicated COG approach. Feel free to steal this idea instead (please!)
It was loosley based on Mathew Brown's RealTimeClock.spin V1.01
m@
Comments
How accurate is a 5Mhz crystal (as on the protoboard) compared to the 32kHz (ish) ones used by RTC chips?
I assumed they are going to be similar.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan