Shop OBEX P1 Docs P2 Docs Learn Events
RTC Emulator ? — Parallax Forums

RTC Emulator ?

adriadri Posts: 34
edited 2009-07-06 15:23 in Propeller 1
Hi,

Anyone got any samples of doing date maths with this object?

eg. Say I want the same thing to happen every day at a certain time. Would I have to start parsing the strings?

If one wasn't using the RTC object would it be possible to do a waitcnt(6912000000000 + cnt) as representing a 24 hour wait...seems a bit odd.

Many thanks

Adri

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-07-06 13:56
    Why do you need date math for your problem? Why would you have to parse the string?

    Just do a string-compare with a time string you set in your program in format hh[noparse]:mm:[/noparse]ss like "12:30:25".

    You can't do a waitcnt( a_vew_hours_later ;o) ... The internal counter is 32 bits, which gives you a max. waittime of ~50sec at 80MHz.
  • JonnyMacJonnyMac Posts: 9,197
    edited 2009-07-06 15:23
    When I was in the irrigation industry (designing sprinkler timers) we used to create as single value from the minutes and hours -- 0 (midnight) to 1439 (11:59:xxPM); this is easy to do: (hrs * 60) + mins. If you need more resolution you could convert your rtc values to raw seconds: (hrs * 3600) + (mins * 60) + secs; this would give you a value between 0 (midnight) and 68399 (11:59:59PM).
Sign In or Register to comment.