Shop OBEX P1 Docs P2 Docs Learn Events
RealTimeClock.Spin -raw data question — Parallax Forums

RealTimeClock.Spin -raw data question

garyggaryg Posts: 420
edited 2014-09-10 02:14 in Propeller 1
Hi
I'm trying to understand the Raw data that is output to my terminal
from the RealTimeClock.spin program that I downloaded from the OBEX.

program is:
RealTimeClock.spin Version 1.01
Author: Mathew Brown
Copyright (c) 2008 Mathew Brown


The output is as follows:
Time:22:37:04 .. Date:Tue 09/09/14 .. Raw data: 4,37,22,9,9,14,3

The 3 at the right end of the output does not seem to have any meaning to me.
I don't see where it comes from.
The 3 never seems to change.
I don't see any reference to it in the RTC demo.

I realize this is a very basic question that I should be able to find, BUT
I can't seem to deduce the answer.

I'll try to attach a link to the program on the OBEX, but I'm not exactly sure how to do that
If I figure it out, I'll edit this post to include the link.

Here is the link
http://obex.parallax.com/object/499

Thanks for any input to this question.
it's the start of a hydroponic pump timer project that I've been thinking about for a while now.

garyg

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2014-09-09 21:06
    PUB ReadTimeReg(Index):Value 'Allows calling object to query timekeeping registers, individually
    
    { Index = 0, indexes seconds       .. 'value' in range 0 to 59
      Index = 1, indexes minutes       .. 'value' in range 0 to 59
      Index = 2, indexes hours         .. 'value' in range 0 to 23
      Index = 3, indexes days          .. 'value' in range 1 up-to 31 (month dependant)
      Index = 4, indexes months        .. 'value' in range 1 to 12
      Index = 5, indexes years         .. 'value' in range 0 to 99    (00 = 2000.... 99 = 2099)
      Index = 6, indexes day of week   .. 'value' in range 1 to 7     (1 = Sunday.... 7 = Saturday)       
    }
    
    Does that help?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-09 21:19
    garyg wrote: »
    The 3 at the right end of the output does not seem to have any meaning to me.
    I don't see where it comes from.
    The 3 never seems to change.

    I'm pretty sure it's the day of the week.

    The "ReadStrWeekday" uses element #6 of the TimeDate array to find the day of the week string and everywhere else in the code the last element of the array accessed is #5. Apparently element #6 (day of the week) gets computed from the other data.
    PUB ReadStrWeekday:StrPtr 'Returns pointer, to a 3 letter string, representing the day of the week
    
      StrPtr := @DayOfWeek + (4* Byte[@TimeDate][6]) 
    
  • garyggaryg Posts: 420
    edited 2014-09-10 02:14
    Thanks

    kuroneko , I was looking for the answer in the RTC_DEMO instead of the RealTimeClock.spin - so your answer did help lots.

    Duane, I ran the RTC_DEMO.spin after setting my current time and date.
    Now the last number in the raw data is 4 because it's Wed here.

    Now that I'm understanding where the numbers are coming from, I'll be looking into
    displaying the results on my LCD display and attempting to drive a buzzer or relays at
    a particular time throughout the day.

    Thanks again
    garyg
Sign In or Register to comment.