Learning the RTC
artkennedy
Posts: 174
in Propeller 1
I am trying to find the handle on the RTC functions before firing up my new DS3231 and I have a couple of questions.
From Extend5v4.FTH:
--- STAMP@ returns a 32-bit millisecond time + day of month in top 5-bits
pub STAMP@ ( --- dhmsc ) time @ day 1+ C@ 27 << + ;
When I call STAMP@ it returns milliseconds but no DOM.
Example:
... .DT --> Mon, 31 Jan 2001 00:16:47 UTC ok
... STAMP@ . --> 1021375 ok
... that is the number of milliseconds in the time but nothing for the 31st day of the month.
What am I missing?
From Extend5v4.FTH:
--- STAMP@ returns a 32-bit millisecond time + day of month in top 5-bits
pub STAMP@ ( --- dhmsc ) time @ day 1+ C@ 27 << + ;
When I call STAMP@ it returns milliseconds but no DOM.
Example:
... .DT --> Mon, 31 Jan 2001 00:16:47 UTC ok
... STAMP@ . --> 1021375 ok
... that is the number of milliseconds in the time but nothing for the 31st day of the month.
What am I missing?
Comments
--- select and set RTC device
pub SETRTC ( $opt.addr -- ) W>B ' sec# C! ' rtc# C! ;
The parameter $opt.addr -> does that indicate that the $opt.addr is a string. If the designation were 'addr' I would take it to mean the I2C address of the RTC but I am confused. Furthermore the Tachyon Extend source specifies $D0 as the address for DS3231. Other sources say $68. If I knew how to make this word work I would just try both.
He'p!
Just 7 lines down in the code "DS3231 $D0 SETRTC