Shop OBEX P1 Docs P2 Docs Learn Events
lightweight RTC object — Parallax Forums

lightweight RTC object

matbmatb Posts: 39
edited 2009-07-04 07:04 in Propeller 1
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@

Comments

  • matbmatb Posts: 39
    edited 2009-07-04 06:12
    No complaints, or just no point?

    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.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2009-07-04 07:04
    From what I can recall, all crystals may wander about 3% due to temperature flux unless they are in an oven environment with controlled temperature. The 32K crystal merely uses less power as the power consumption of a microprocessor is related to the clock speed. With a dedicated RTC and outboard battery, the 32Kk crystal is an energy saver. Wlth an inboard RTC, the time must either be reset on each and every power on or a larger reserve power supply must be employed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Sign In or Register to comment.