Shop OBEX P1 Docs P2 Docs Learn Events
event triggering from ds1302 time — Parallax Forums

event triggering from ds1302 time

ArchiverArchiver Posts: 46,084
edited 2004-01-18 01:15 in General Discussion
I'm trying to read a time value from the DS1302 chip and then
evaluate it against an "alarm time." I'm able to set the time and
display it in the debug window, but I can't yet capture the value to
compare it to my setpoint.

I think the reason this string
DEBUG HEX2 Hours,":",HEX2 Minutes,":",HEX2 Seconds,CR
prints the time value is because the values of those variable are
held in these declarations.
Seconds VAR Byte
Minutes VAR Byte
Hours VAR Byte

but I can't find a way to use Hours:Minutes:Seconds to trigger the
event.

can anyone help?

I've learned a lot from just reading on this site and appreciate all
the work that everyone is doing to make the site such a useful tool.'

thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-01-17 18:13
    This should be a piece o'cake. If you have the time successfully
    stored in the variables, here is one approach. You have to remember
    that time is HEX:
    IF hours=$07 AND Minutes=$30 THEN DEBUG BELL

    I like to convert the time into a continuous variable that goes from
    0 to 1439 for the minute of the day, or 0 to
    14390 for ten second resolution.
    julian = hours.nib1*10+hours.nib0*6+minutes.nib1*10+minutes.nib0

    In that scheme, 7:30 am is 450
    IF julian=450 THEN DEBUG BELL

    -- Tracy


    >I'm trying to read a time value from the DS1302 chip and then
    >evaluate it against an "alarm time." I'm able to set the time and
    >display it in the debug window, but I can't yet capture the value to
    >compare it to my setpoint.
    >
    >I think the reason this string
    >DEBUG HEX2 Hours,":",HEX2 Minutes,":",HEX2 Seconds,CR
    >prints the time value is because the values of those variable are
    >held in these declarations.
    >Seconds VAR Byte
    >Minutes VAR Byte
    >Hours VAR Byte
    >
    >but I can't find a way to use Hours:Minutes:Seconds to trigger the
    >event.
    >
    >can anyone help?
    >
    >I've learned a lot from just reading on this site and appreciate all
    >the work that everyone is doing to make the site such a useful tool.'
    >
    >thanks
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-18 01:15
    indeed, simplicity itself. works great, and many thanks for the
    timely and helpful response.

    Steve Hinote

    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > This should be a piece o'cake. If you have the time successfully
    > stored in the variables, here is one approach. You have to
    remember
    > that time is HEX:
    > IF hours=$07 AND Minutes=$30 THEN DEBUG BELL
    >
    > I like to convert the time into a continuous variable that goes
    from
    > 0 to 1439 for the minute of the day, or 0 to
    > 14390 for ten second resolution.
    > julian =
    hours.nib1*10+hours.nib0*6+minutes.nib1*10+minutes.nib0
    >
    > In that scheme, 7:30 am is 450
    > IF julian=450 THEN DEBUG BELL
    >
    > -- Tracy
    >
    >
    > >I'm trying to read a time value from the DS1302 chip and then
    > >evaluate it against an "alarm time." I'm able to set the time and
    > >display it in the debug window, but I can't yet capture the value
    to
    > >compare it to my setpoint.
    > >
    > >I think the reason this string
    > >DEBUG HEX2 Hours,":",HEX2 Minutes,":",HEX2 Seconds,CR
    > >prints the time value is because the values of those variable are
    > >held in these declarations.
    > >Seconds VAR Byte
    > >Minutes VAR Byte
    > >Hours VAR Byte
    > >
    > >but I can't find a way to use Hours:Minutes:Seconds to trigger the
    > >event.
    > >
    > >can anyone help?
    > >
    > >I've learned a lot from just reading on this site and appreciate
    all
    > >the work that everyone is doing to make the site such a useful
    tool.'
    > >
    > >thanks
Sign In or Register to comment.