Shop OBEX P1 Docs P2 Docs Learn Events
overview of RTC date/time handling in Spin? — Parallax Forums

overview of RTC date/time handling in Spin?

rikkirikki Posts: 53
edited 2016-06-01 21:51 in Propeller 1
Hello,
I'm a beginner with the Propeller product family.
I have both a Propeller Mini and a Spinerette.
I also have a DS1307 board from another firm which has been proven with the Propeller.


I want to create an application to run at a given time of day and look up a time of day constant from a table of dates (YR/MM/DD). I would be happy to use the Spinerette if possible, otherwise I'll use the Mini + DS1307.

I've surveyed the OBEX and have not found an example of time and date formats applicable in the Spin language.
Can anyone provide guidance or point me to an example from the OBEX?

Thanks very much in advance!

Comments

  • I find it easiest to convert time-of-day to minutes and use that as a flag. I did an audio alarm project for a friend who wanted audio cues to play during the day. Process-wise, I would read the RTC and look for the seconds to be new and zero. When that is the case I multiply the current hour by 60 and add to the minutes -- this is the TOD value I use for looking into a table of entries. It's pretty easy, actually.
  • Thank you very much for that, JonnyMac.

    What you described makes sense and I'll happily and gratefully take the same approach.

    I did purchase a Spinerette for this application, as it does have an RTC, (and my I/O needs are minimal).
    Presumably there is some documentation to describe the RTC clock usage in the Spinerette, but I have yet to locate it.
    (I am aware the Spinerette is at E-O-L, and I have further plans for that product)

    I have not yet understood in what format the RTC data is on the Spinerette (or would be with the combination of Propeller Mini + external RTC).
    I assume just a hex value at some location. I've no idea where
    I do need date though, as well as time-of-day.


    My interest otherwise for future purposes is with the Mini, primarily for use with the Xbee products. In that use-case I would not normally need a RTC, but I would like to learn how to use an external RTC with the Mini at some point.

    As I have the Spinerette on hand for this one-time need, integration of the Mini with the external RTC isn't a priority at the moment, if I can get the Spinerette working for my immediate one-time project.


    My understanding of I2C serial is minimal, but there are no doubt many good code examples in the PropellerTool library and the OBEX.
    So I have some further homework to do.

    I'm less than qualified, being not a software developer.
    My experience is in industrial automation, where time and date would usually be in the IEC Time format, a datatype for date and time used in PLCs and SCADA.


    The Propeller is such an intriguing product that I am determined to learn.
    I have yet to power-up either of my Propeller boards for the first time. I hope to do so today in fact. I only just installed PropellerTool, and have failed so far in my attempts to install simpleIDE.
    (I'm still learning the installation of non-packaged software in Linux / Ubuntu).


    I am expecting to use the Propeller products to great advantage in the near future.

    Thanks again for you help. It's a much-needed step in the right direction.

  • rikkirikki Posts: 53
    edited 2016-06-01 21:49
    The EDIT button isn't working for me on this forum/page for some reason.
  • kwinnkwinn Posts: 8,697
    rikki wrote: »
    Sorry, I intended to say above that I have NO further plans for the Spinerette.
    I purchased it only for my immediate one-time need.

    The EDIT button isn't working for me on this forum/page for some reason.

    You need to click on the edit button then move down and click on "edit" in the popup box below.
  • rikkirikki Posts: 53
    edited 2016-06-01 22:42
    kwinn wrote: »
    ...
    You need to click on the edit button then move down and click on "edit" in the popup box below.

    Many thanks. Might ask what is the probability of success with a Propeller if I can't even see the EDIT button there.


    Found this..
    date_time
    http://obex.parallax.com/object/191

    and..
    http://obex.parallax.com/object/36
    For the PCF8583 RTC...

    This may be the RTC on the Spinerette, yeah?
    The BOM doesn't list a part-number for it..


    ( and I edited the thread title to include "..RTC.." )
  • kwinnkwinn Posts: 8,697
    rikki wrote: »
    kwinn wrote: »
    ...
    You need to click on the edit button then move down and click on "edit" in the popup box below.

    Many thanks. Might ask what is the probability of success with a Propeller if I can't even see the EDIT button there.


    Found this..
    date_time
    http://obex.parallax.com/object/191

    and..
    http://obex.parallax.com/object/36
    For the PCF8583 RTC...

    This may be the RTC on the Spinerette, yeah?
    The BOM doesn't list a part-number for it..


    ( and I edited the thread title to include "..RTC.." )

    Chances are pretty good if you are persistent and ask for help on the forum when you get stuck.

    With regard to the time format, I would use the same format to store the time table that the RTC or OBEX interface object uses.
Sign In or Register to comment.