Shop OBEX P1 Docs P2 Docs Learn Events
Rtc pcf8563 — Parallax Forums

Rtc pcf8563

ArchiverArchiver Posts: 46,084
edited 2004-06-29 19:49 in General Discussion
I am having some problems getting my phillips PCF8563 real time clock
to work with the basic stamp/

I am able to set the time and date correctly. The time works well,
but when the day switches over it seems to be switching the month
also.

I set the time for 23:59, and wait for the date to switch, it will
increment the month and the day and I can't figure out why, it will
go from directly from 7/2/04, to 8/3/04

It also allows the month to go higher then 12.

anyone have any luck trouble shooting a problem like this?

thanks
MikeDolan
MikeD@B...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-28 21:16
    By any chance do you have your days and months reversed as in
    MMDDYYYY as compared to DDMMYYYY

    The changing of the month when the time changes is what has led me to ask
    the question

    Original Message
    From: MikDolan54 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AGiibyeSzpj4I0bj_eFWuQw_NTWByhbEvKlMC41dyrzHkKHsbwdEg0uxZOmKhfFF8McXkjVxLv0q]MikeD@B...[/url
    Sent: Monday, June 28, 2004 4:09 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] RTC PCF8563


    I am having some problems getting my phillips PCF8563 real time clock
    to work with the basic stamp/

    I am able to set the time and date correctly. The time works well,
    but when the day switches over it seems to be switching the month
    also.

    I set the time for 23:59, and wait for the date to switch, it will
    increment the month and the day and I can't figure out why, it will
    go from directly from 7/2/04, to 8/3/04

    It also allows the month to go higher then 12.

    anyone have any luck trouble shooting a problem like this?

    thanks
    MikeDolan
    MikeD@B...






    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.

    Yahoo! Groups Links
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-28 22:06
    Do you mean the PCF8583? The year/date register is a bit funky on that
    device; if I remember correctly the year value is actually an offset
    from the last leap year (0 - 3, set in bits 6 and 7 of register 5). Are
    you setting it correctly? Today, for example, would be coded as:

    Reg $05 --> %00101000
    --> %00 = 0 (2004 is leapyear)
    --> 10 = 2 (tens digit of 28th)
    --> 1000 = 8 (ones digit of 28th)

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: MikDolan54 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=j8GRxadU8rnIETgYIJfUg6v5A8NIssicMdmifGzy9WM14m6eIiQ8wBvxhmBHuYeFr9FLhPX8RG8]MikeD@B...[/url
    Sent: Monday, June 28, 2004 3:09 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] RTC PCF8563


    I am having some problems getting my phillips PCF8563 real time clock
    to work with the basic stamp/

    I am able to set the time and date correctly. The time works well,
    but when the day switches over it seems to be switching the month
    also.

    I set the time for 23:59, and wait for the date to switch, it will
    increment the month and the day and I can't figure out why, it will
    go from directly from 7/2/04, to 8/3/04

    It also allows the month to go higher then 12.

    anyone have any luck trouble shooting a problem like this?

    thanks
    MikeDolan
    MikeD@B...
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-29 14:25
    Jon,
    thanks for the response...
    I haven't solved the problem yet, but I checked a chip I was using
    this morning and it is a PCF8583 while my data sheet is for the
    PCF8563.

    I will find the correct data sheet and go from there.

    Mike Dolan


    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > Do you mean the PCF8583? The year/date register is a bit funky on
    that
    > device; if I remember correctly the year value is actually an offset
    > from the last leap year (0 - 3, set in bits 6 and 7 of register
    5). Are
    > you setting it correctly? Today, for example, would be coded as:
    >
    > Reg $05 --> %00101000
    > --> %00 = 0 (2004 is leapyear)
    > --> 10 = 2 (tens digit of 28th)
    > --> 1000 = 8 (ones digit of 28th)
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: MikDolan54 [noparse][[/noparse]mailto:MikeD@B...]
    > Sent: Monday, June 28, 2004 3:09 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] RTC PCF8563
    >
    >
    > I am having some problems getting my phillips PCF8563 real time
    clock
    > to work with the basic stamp/
    >
    > I am able to set the time and date correctly. The time works well,
    > but when the day switches over it seems to be switching the month
    > also.
    >
    > I set the time for 23:59, and wait for the date to switch, it
    will
    > increment the month and the day and I can't figure out why, it
    will
    > go from directly from 7/2/04, to 8/3/04
    >
    > It also allows the month to go higher then 12.
    >
    > anyone have any luck trouble shooting a problem like this?
    >
    > thanks
    > MikeDolan
    > MikeD@B...
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-29 15:58
    Jon,

    I've looked things over and your were correct I was using the wrong
    datasheet. Thanks for the help.

    How do I keep track of the year with the PCF8583. It simply goes
    from 0-3 and rolls over.

    Do I have to keep track of how many times this year rolls over in a
    EEPROM, and if so then I guess I have to keep this thing on all the
    time. In other words if I were to not monitor it for a multiple
    year span, how would I distinquish the year?

    any insight would be appreciated...

    thanks
    mike











    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > Do you mean the PCF8583? The year/date register is a bit funky on
    that
    > device; if I remember correctly the year value is actually an offset
    > from the last leap year (0 - 3, set in bits 6 and 7 of register
    5). Are
    > you setting it correctly? Today, for example, would be coded as:
    >
    > Reg $05 --> %00101000
    > --> %00 = 0 (2004 is leapyear)
    > --> 10 = 2 (tens digit of 28th)
    > --> 1000 = 8 (ones digit of 28th)
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: MikDolan54 [noparse][[/noparse]mailto:MikeD@B...]
    > Sent: Monday, June 28, 2004 3:09 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] RTC PCF8563
    >
    >
    > I am having some problems getting my phillips PCF8563 real time
    clock
    > to work with the basic stamp/
    >
    > I am able to set the time and date correctly. The time works well,
    > but when the day switches over it seems to be switching the month
    > also.
    >
    > I set the time for 23:59, and wait for the date to switch, it
    will
    > increment the month and the day and I can't figure out why, it
    will
    > go from directly from 7/2/04, to 8/3/04
    >
    > It also allows the month to go higher then 12.
    >
    > anyone have any luck trouble shooting a problem like this?
    >
    > thanks
    > MikeDolan
    > MikeD@B...
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-29 16:16
    Since you are entering the year anyway, you just need to know its relationship vis-
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-29 19:49
    Expanding on Jon's idea, you could using code
    something like the following to track the year.
    Note that the PFC8593 does count yr=0 as a leap
    year and yr=1,2 or 3 as non-leap yeas, for the 28
    or 29 days in February. The code looks for
    rollovers in the yearly and 4 year cycle, and
    automatically updates two eeprom locations when
    necessary the first time the code runs after a
    rollover.

    yr0 DATA Word 2004 ' base of 4 year cycle, updated once/ 4 years
    yrx DATA Word 2004 ' 1 year cycle, updated once/ year.

    ' ...
    GOSUB get_yr ' yr=0 to 3 from PFC8593
    READ yr0, Word baseYear
    READ yrx, Word nowYear
    IF baseYear+yr < nowYear THEN ' yr has rolled over from 11 to 00
    year=baseYear+4 ' new leap year cycle
    WRITE yr0, Word year
    WRITE yrx, Word year
    ELSEIF basYear+yr > nowYear THEN
    Year=nowYear+1
    WRITE yrx, Word Year
    ELSE
    Year=nowYear
    ENDIF
    debug ? year

    -- Tracy




    >Since you are entering the year anyway, you just
    >need to know its relationship vis-
Sign In or Register to comment.